toggle xmm0: //cost 2 instructions, 2 registers
vpcmpeqd xmm1,xmm1,xmm1
vpcmpeqd xmm0,xmm0,xmm1
is there single instruction method?
what's the best way to toggle simd register
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: what's the best way to toggle simd register
By using a memory operand pointing to a constant (pxor to all ones would be the most obvious). Actually inverting the preceding test so you don't need this in the first place would be a much better idea though
You currently appear to be doinginstead of false : true, so it doesn't actually toggle anything.
You currently appear to be doing
Code: Select all
x = (x == true) ? true : false;
Re: what's the best way to toggle simd register
it should be
I wonder why there isn't vpnot instruction.
Code: Select all
vpcmpeqd xmm1,xmm1,xmm1
vpxor xmm0,xmm0,xmm1