Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Bill_P_1
Beginner
181 Views

vperm2f128 operands

I'm playing around with AVX instructions and came accross one named vperm2f128. So here's the thing. After executing (GAS syntax)

vperm2f128 $1, %ymm0, %ymm1, %ymm2

%ymm2 becomes %ymm1 second half followed by %ymm1 first half

What exactly happens with %ymm0 ? I mean how it's used in this instruction?

0 Kudos
1 Reply
Thomas_W_Intel
Employee
181 Views

vperm2f128 has two sources and one destination. Depending on the immediate, it fills the lower and upper 128-bit lane of the destination with one of the lanes from the sources (or zeros the lane). Bit 0-3 determine the content of the lower lane, where 0 means lower lane source1, 1 means upper lane source1, 2 means lower lane source2, 3 means upper lane source2, and 8 means zero. Similarly bits 4-7 determine the content of the upper lane. In your example, you used $1 and therefore swapped the lanes from source1 into the destination (1 for lower lane, 0 for upper lane). A precise description can be found on page 5-338 of the Intel® Advanced Vector Extensions Programming Reference.
Reply