]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/asm: VPERMQ's imm8 arg is an uint8
authorDaniel Martí <mvdan@mvdan.cc>
Tue, 13 Mar 2018 20:37:05 +0000 (20:37 +0000)
committerDaniel Martí <mvdan@mvdan.cc>
Tue, 13 Mar 2018 21:29:45 +0000 (21:29 +0000)
The imm8 argument consists of 4 2-bit indices, so it can take values up
to $255. However, the assembler was treating it as Yi8, which reads
"fits in int8". Add a Yu8 variant, to also keep backwards compatibility
with negative values possible with Yi8.

Fixes #24378.

Change-Id: I24ddb19c219b54d039a6c1bcdb903717d1c7c3b8
Reviewed-on: https://go-review.googlesource.com/100475
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/asm/internal/asm/testdata/amd64enc.s
src/cmd/internal/obj/x86/asm6.go

index 65aecf8faf40054e715c57af6b450e977a5ea159..6ce7ea655014ed4b2e5d811e99e9c9ce4c2e87de 100644 (file)
@@ -8742,6 +8742,8 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$0
        VPERMQ $7, (R11), Y11                   // c443fd001b07
        VPERMQ $7, Y2, Y11                      // c463fd00da07
        VPERMQ $7, Y11, Y11                     // c443fd00db07
+       VPERMQ $-40, Y8, Y8                     // c4407800c0d8
+       VPERMQ $216, Y8, Y8                     // c443fd00c0d8
        VPEXTRB $7, X2, (BX)                    // c4e379141307
        VPEXTRB $7, X11, (BX)                   // c46379141b07
        VPEXTRB $7, X2, (R11)                   // c4c379141307
index 402349c91460c8d7e912bea667fdebebde036f48..0fbc552ddab492d4a3fd339e9c677aa05009e6ce 100644 (file)
@@ -952,6 +952,9 @@ var yvex_xi3 = []ytab{
 }
 
 var yvex_vpermpd = []ytab{
+       {Zvex_i_rm_r, 2, argList{Yu8, Yym, Yyr}},
+       // Allow int8 for backwards compatibility with negative values
+       // like $-1.
        {Zvex_i_rm_r, 2, argList{Yi8, Yym, Yyr}},
 }