From: isharipo Date: Thu, 17 May 2018 15:20:53 +0000 (+0300) Subject: cmd/internal/obj/x86: fix VPERMQ and VPERMPD ytab X-Git-Tag: go1.11beta1~401 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=d2c68bb65f7093235bd9a43629c41d4403950e27;p=gostls13.git cmd/internal/obj/x86: fix VPERMQ and VPERMPD ytab Fixes invalid encoding of VPERMQ and VPERMPD that use negative immediate argument. Fixes #25418 Updates #25420 Change-Id: Idd8180c4c632a76b76f3a68efd5f930d94431994 Reviewed-on: https://go-review.googlesource.com/113615 Run-TryBot: Iskander Sharipov TryBot-Result: Gobot Gobot Reviewed-by: Daniel Martí Reviewed-by: Ilya Tocar --- diff --git a/src/cmd/asm/internal/asm/testdata/amd64enc_extra.s b/src/cmd/asm/internal/asm/testdata/amd64enc_extra.s index 8839704ae0..7fd481abf3 100644 --- a/src/cmd/asm/internal/asm/testdata/amd64enc_extra.s +++ b/src/cmd/asm/internal/asm/testdata/amd64enc_extra.s @@ -294,8 +294,11 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$0 SHA256MSG2 X2, X11 // 440f38cdda SHA256MSG2 X11, X11 // 450f38cddb // Test VPERMQ with both uint8 and int8 immediate args - VPERMQ $-40, Y8, Y8 // c4407800c0d8 + VPERMQ $-40, Y8, Y8 // c443fd00c0d8 VPERMQ $216, Y8, Y8 // c443fd00c0d8 + // Test that VPERMPD that shares ytab list with VPERMQ continues to work too. + VPERMPD $-40, Y7, Y7 // c4e3fd01ffd8 + VPERMPD $216, Y7, Y7 // c4e3fd01ffd8 // Check that LEAL is permitted to use overflowing offset. LEAL 2400959708(BP)(R10*1), BP // 428dac15dcbc1b8f LEAL 3395469782(AX)(R10*1), AX // 428d8410d6c162ca diff --git a/src/cmd/internal/obj/x86/asm6.go b/src/cmd/internal/obj/x86/asm6.go index 8da842340f..3a7689e28d 100644 --- a/src/cmd/internal/obj/x86/asm6.go +++ b/src/cmd/internal/obj/x86/asm6.go @@ -931,7 +931,7 @@ var yvex_xi3 = []ytab{ } var yvex_vpermpd = []ytab{ - {Zvex_i_rm_r, 2, argList{Yu8, Yym, Yyr}}, + {Zvex_i_rm_r, 0, argList{Yu8, Yym, Yyr}}, // Allow int8 for backwards compatibility with negative values // like $-1. {Zvex_i_rm_r, 2, argList{Yi8, Yym, Yyr}},