From: Jan Beulich Date: Thu, 8 Mar 2018 07:47:32 +0000 (+0100) Subject: x86: add GFNI, VAES, and VPCLMUL checking to cpu_flags_match() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=929f69fa966f9ed7a1a8cce19a168348295863c2;p=binutils-gdb.git x86: add GFNI, VAES, and VPCLMUL checking to cpu_flags_match() Just like for the AVX/AES and AVX/PCLMUL combinations, AVX/GFN, AVX512F/GFNI, AVX512F/VAES, and AVX512F/PCLMUL need special handling to deal with the pair of required checks specified in the templates. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index bd58786864a..d741855c2e9 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,25 @@ +2018-03-08 Jan Beulich + + * config/tc-i386.c (cpu_flags_match): Add GFNI check to AVX + logic. Add respective logic for AVX512F. + * testsuite/gas/i386/arch-avx-1.s: Add GFNI test. + testsuite/gas/i386/arch-avx-1.d, + testsuite/gas/i386/arch-avx-1-1.l, + testsuite/gas/i386/arch-avx-1-2.l, + testsuite/gas/i386/arch-avx-1-3.l, + testsuite/gas/i386/arch-avx-1-4.l, + testsuite/gas/i386/arch-avx-1-5.l, + testsuite/gas/i386/arch-avx-1-6.l: Adjust expectations. + * testsuite/gas/i386/arch-avx-1-7.l, + testsuite/gas/i386/arch-avx-1-7.s, + testsuite/gas/i386/arch-avx-1-8.l, + testsuite/gas/i386/arch-avx-1-8.s, + testsuite/gas/i386/avx512f-plain.l, + testsuite/gas/i386/avx512f-plain.s, + testsuite/gas/i386/avx512vl-plain.l, + testsuite/gas/i386/avx512vl-plain.s: New. + * testsuite/gas/i386/i386.exp: Run new tests. + 2018-03-08 Jan Beulich * config/tc-i386.c (cpu_flags_match): Move AVX512VL check ahead. diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 7f2bd2dace4..7df5d028cc9 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -1722,13 +1722,23 @@ cpu_flags_match (const insn_template *t) { if (x.bitfield.cpuavx) { - /* We only need to check AES/PCLMUL/SSE2AVX with AVX. */ + /* We need to check a few extra flags with AVX. */ if (cpu.bitfield.cpuavx && (!t->opcode_modifier.sse2avx || sse2avx) && (!x.bitfield.cpuaes || cpu.bitfield.cpuaes) + && (!x.bitfield.cpugfni || cpu.bitfield.cpugfni) && (!x.bitfield.cpupclmul || cpu.bitfield.cpupclmul)) match |= CPU_FLAGS_ARCH_MATCH; } + else if (x.bitfield.cpuavx512f) + { + /* We need to check a few extra flags with AVX512F. */ + if (cpu.bitfield.cpuavx512f + && (!x.bitfield.cpugfni || cpu.bitfield.cpugfni) + && (!x.bitfield.cpuvaes || cpu.bitfield.cpuvaes) + && (!x.bitfield.cpuvpclmulqdq || cpu.bitfield.cpuvpclmulqdq)) + match |= CPU_FLAGS_ARCH_MATCH; + } else match |= CPU_FLAGS_ARCH_MATCH; } diff --git a/gas/testsuite/gas/i386/arch-avx-1-1.l b/gas/testsuite/gas/i386/arch-avx-1-1.l index 6d5024e1016..cdeea5f320d 100644 --- a/gas/testsuite/gas/i386/arch-avx-1-1.l +++ b/gas/testsuite/gas/i386/arch-avx-1-1.l @@ -1,6 +1,7 @@ .*: Assembler messages: .*:4: Error: .* .*:6: Error: .* +.*:8: Error: .* GAS LISTING .* @@ -11,3 +12,5 @@ GAS LISTING .* [ ]*4[ ]+vaesenc \(%ecx\),%xmm0,%xmm2 [ ]*5[ ]+\# PCLMUL \+ AVX [ ]*6[ ]+vpclmulqdq \$8,%xmm4,%xmm6,%xmm2 +[ ]*7[ ]+# GFNI \+ AVX +[ ]*8[ ]+vgf2p8mulb %xmm1,%xmm2,%xmm3 diff --git a/gas/testsuite/gas/i386/arch-avx-1-2.l b/gas/testsuite/gas/i386/arch-avx-1-2.l index 6d5024e1016..cdeea5f320d 100644 --- a/gas/testsuite/gas/i386/arch-avx-1-2.l +++ b/gas/testsuite/gas/i386/arch-avx-1-2.l @@ -1,6 +1,7 @@ .*: Assembler messages: .*:4: Error: .* .*:6: Error: .* +.*:8: Error: .* GAS LISTING .* @@ -11,3 +12,5 @@ GAS LISTING .* [ ]*4[ ]+vaesenc \(%ecx\),%xmm0,%xmm2 [ ]*5[ ]+\# PCLMUL \+ AVX [ ]*6[ ]+vpclmulqdq \$8,%xmm4,%xmm6,%xmm2 +[ ]*7[ ]+# GFNI \+ AVX +[ ]*8[ ]+vgf2p8mulb %xmm1,%xmm2,%xmm3 diff --git a/gas/testsuite/gas/i386/arch-avx-1-3.l b/gas/testsuite/gas/i386/arch-avx-1-3.l index 6d5024e1016..cdeea5f320d 100644 --- a/gas/testsuite/gas/i386/arch-avx-1-3.l +++ b/gas/testsuite/gas/i386/arch-avx-1-3.l @@ -1,6 +1,7 @@ .*: Assembler messages: .*:4: Error: .* .*:6: Error: .* +.*:8: Error: .* GAS LISTING .* @@ -11,3 +12,5 @@ GAS LISTING .* [ ]*4[ ]+vaesenc \(%ecx\),%xmm0,%xmm2 [ ]*5[ ]+\# PCLMUL \+ AVX [ ]*6[ ]+vpclmulqdq \$8,%xmm4,%xmm6,%xmm2 +[ ]*7[ ]+# GFNI \+ AVX +[ ]*8[ ]+vgf2p8mulb %xmm1,%xmm2,%xmm3 diff --git a/gas/testsuite/gas/i386/arch-avx-1-4.l b/gas/testsuite/gas/i386/arch-avx-1-4.l index 3d560b1b52e..152ac772430 100644 --- a/gas/testsuite/gas/i386/arch-avx-1-4.l +++ b/gas/testsuite/gas/i386/arch-avx-1-4.l @@ -1,5 +1,6 @@ .*: Assembler messages: .*:6: Error: .* +.*:8: Error: .* GAS LISTING .* @@ -11,3 +12,5 @@ GAS LISTING .* [ ]*4[ ]+11 [ ]*5[ ]+\# PCLMUL \+ AVX [ ]*6[ ]+vpclmulqdq \$8,%xmm4,%xmm6,%xmm2 +[ ]*7[ ]+# GFNI \+ AVX +[ ]*8[ ]+vgf2p8mulb %xmm1,%xmm2,%xmm3 diff --git a/gas/testsuite/gas/i386/arch-avx-1-5.l b/gas/testsuite/gas/i386/arch-avx-1-5.l index cc98a7a2d81..531739ca185 100644 --- a/gas/testsuite/gas/i386/arch-avx-1-5.l +++ b/gas/testsuite/gas/i386/arch-avx-1-5.l @@ -1,5 +1,6 @@ .*: Assembler messages: .*:4: Error: .* +.*:8: Error: .* GAS LISTING .* @@ -11,3 +12,5 @@ GAS LISTING .* [ ]*5[ ]+\# PCLMUL \+ AVX [ ]*6[ ]+\?\?\?\? C4E34944 vpclmulqdq \$8,%xmm4,%xmm6,%xmm2 [ ]*6[ ]+D408 +[ ]*7[ ]+# GFNI \+ AVX +[ ]*8[ ]+vgf2p8mulb %xmm1,%xmm2,%xmm3 diff --git a/gas/testsuite/gas/i386/arch-avx-1-6.l b/gas/testsuite/gas/i386/arch-avx-1-6.l index 6d5024e1016..cdeea5f320d 100644 --- a/gas/testsuite/gas/i386/arch-avx-1-6.l +++ b/gas/testsuite/gas/i386/arch-avx-1-6.l @@ -1,6 +1,7 @@ .*: Assembler messages: .*:4: Error: .* .*:6: Error: .* +.*:8: Error: .* GAS LISTING .* @@ -11,3 +12,5 @@ GAS LISTING .* [ ]*4[ ]+vaesenc \(%ecx\),%xmm0,%xmm2 [ ]*5[ ]+\# PCLMUL \+ AVX [ ]*6[ ]+vpclmulqdq \$8,%xmm4,%xmm6,%xmm2 +[ ]*7[ ]+# GFNI \+ AVX +[ ]*8[ ]+vgf2p8mulb %xmm1,%xmm2,%xmm3 diff --git a/gas/testsuite/gas/i386/arch-avx-1-7.l b/gas/testsuite/gas/i386/arch-avx-1-7.l new file mode 100644 index 00000000000..cdeea5f320d --- /dev/null +++ b/gas/testsuite/gas/i386/arch-avx-1-7.l @@ -0,0 +1,16 @@ +.*: Assembler messages: +.*:4: Error: .* +.*:6: Error: .* +.*:8: Error: .* +GAS LISTING .* + + +[ ]*1[ ]+\.include "arch-avx-1\.s" +[ ]*1[ ]+\# Test -march= +[ ]*2[ ]+\.text +[ ]*3[ ]+\# AES \+ AVX +[ ]*4[ ]+vaesenc \(%ecx\),%xmm0,%xmm2 +[ ]*5[ ]+\# PCLMUL \+ AVX +[ ]*6[ ]+vpclmulqdq \$8,%xmm4,%xmm6,%xmm2 +[ ]*7[ ]+# GFNI \+ AVX +[ ]*8[ ]+vgf2p8mulb %xmm1,%xmm2,%xmm3 diff --git a/gas/testsuite/gas/i386/arch-avx-1-7.s b/gas/testsuite/gas/i386/arch-avx-1-7.s new file mode 100644 index 00000000000..8c4054839b0 --- /dev/null +++ b/gas/testsuite/gas/i386/arch-avx-1-7.s @@ -0,0 +1 @@ +.include "arch-avx-1.s" diff --git a/gas/testsuite/gas/i386/arch-avx-1-8.l b/gas/testsuite/gas/i386/arch-avx-1-8.l new file mode 100644 index 00000000000..9b752eacf44 --- /dev/null +++ b/gas/testsuite/gas/i386/arch-avx-1-8.l @@ -0,0 +1,16 @@ +.*: Assembler messages: +.*:4: Error: .* +.*:6: Error: .* +GAS LISTING .* + + +[ ]*1[ ]+\.include "arch-avx-1\.s" +[ ]*1[ ]+\# Test -march= +[ ]*2[ ]+\.text +[ ]*3[ ]+\# AES \+ AVX +[ ]*4[ ]+vaesenc \(%ecx\),%xmm0,%xmm2 +[ ]*5[ ]+\# PCLMUL \+ AVX +[ ]*6[ ]+vpclmulqdq \$8,%xmm4,%xmm6,%xmm2 +[ ]*7[ ]+# GFNI \+ AVX +[ ]*8[ ]+\?\?\?\? C4E269CF vgf2p8mulb %xmm1,%xmm2,%xmm3 +[ ]*8[ ]+D9 diff --git a/gas/testsuite/gas/i386/arch-avx-1-8.s b/gas/testsuite/gas/i386/arch-avx-1-8.s new file mode 100644 index 00000000000..8c4054839b0 --- /dev/null +++ b/gas/testsuite/gas/i386/arch-avx-1-8.s @@ -0,0 +1 @@ +.include "arch-avx-1.s" diff --git a/gas/testsuite/gas/i386/arch-avx-1.d b/gas/testsuite/gas/i386/arch-avx-1.d index fa6b8ca25da..73af471d004 100644 --- a/gas/testsuite/gas/i386/arch-avx-1.d +++ b/gas/testsuite/gas/i386/arch-avx-1.d @@ -1,4 +1,4 @@ -#as: -march=generic32+avx+aes+pclmul +#as: -march=generic32+avx+aes+pclmul+gfni #objdump: -dw #name: i386 arch avx 1 @@ -9,4 +9,5 @@ Disassembly of section .text: 0+ <.text>: [ ]*[a-f0-9]+: c4 e2 79 dc 11 vaesenc \(%ecx\),%xmm0,%xmm2 [ ]*[a-f0-9]+: c4 e3 49 44 d4 08 vpclmulqdq \$0x8,%xmm4,%xmm6,%xmm2 +[ ]*[a-f0-9]+: c4 e2 69 cf d9 vgf2p8mulb %xmm1,%xmm2,%xmm3 #pass diff --git a/gas/testsuite/gas/i386/arch-avx-1.s b/gas/testsuite/gas/i386/arch-avx-1.s index 8abd99be8d5..edea2aa3336 100644 --- a/gas/testsuite/gas/i386/arch-avx-1.s +++ b/gas/testsuite/gas/i386/arch-avx-1.s @@ -4,3 +4,5 @@ vaesenc (%ecx),%xmm0,%xmm2 # PCLMUL + AVX vpclmulqdq $8,%xmm4,%xmm6,%xmm2 +# GFNI + AVX +vgf2p8mulb %xmm1,%xmm2,%xmm3 diff --git a/gas/testsuite/gas/i386/avx512f-plain.l b/gas/testsuite/gas/i386/avx512f-plain.l new file mode 100644 index 00000000000..d910b762bf4 --- /dev/null +++ b/gas/testsuite/gas/i386/avx512f-plain.l @@ -0,0 +1,26 @@ +.*: Assembler messages: +.*:5: Error: .* +.*:6: Error: .* +.*:7: Error: .* +GAS LISTING .* + + +[ ]*1[ ]+\.text +[ ]*2[ ]+\.arch generic32 +[ ]*3[ ]+\.arch \.avx512f +[ ]*4[ ]+_start: +[ ]*5[ ]+vaesenc[ ]+%zmm1, %zmm2, %zmm3 +[ ]*6[ ]+vgf2p8mulb[ ]+%zmm1, %zmm2, %zmm3 +[ ]*7[ ]+vpclmulqdq[ ]+\$0, %zmm1, %zmm2, %zmm3 +[ ]*8[ ]* +[ ]*9[ ]+\.arch \.vaes +[ ]*10[ ]+\?\?\?\? 62F26D48[ ]+vaesenc[ ]+%zmm1, %zmm2, %zmm3 +[ ]*10[ ]+DCD9 +[ ]*11[ ]* +[ ]*12[ ]+\.arch \.gfni +[ ]*13[ ]+\?\?\?\? 62F26D48[ ]+vgf2p8mulb[ ]+%zmm1, %zmm2, %zmm3 +[ ]*13[ ]+CFD9 +[ ]*14[ ]* +[ ]*15[ ]+\.arch \.vpclmulqdq +[ ]*16[ ]+\?\?\?\? 62F36D48[ ]+vpclmulqdq[ ]+\$0, %zmm1, %zmm2, %zmm3 +[ ]*16[ ]+44D900 diff --git a/gas/testsuite/gas/i386/avx512f-plain.s b/gas/testsuite/gas/i386/avx512f-plain.s new file mode 100644 index 00000000000..d295d70f5bf --- /dev/null +++ b/gas/testsuite/gas/i386/avx512f-plain.s @@ -0,0 +1,16 @@ + .text + .arch generic32 + .arch .avx512f +_start: + vaesenc %zmm1, %zmm2, %zmm3 + vgf2p8mulb %zmm1, %zmm2, %zmm3 + vpclmulqdq $0, %zmm1, %zmm2, %zmm3 + + .arch .vaes + vaesenc %zmm1, %zmm2, %zmm3 + + .arch .gfni + vgf2p8mulb %zmm1, %zmm2, %zmm3 + + .arch .vpclmulqdq + vpclmulqdq $0, %zmm1, %zmm2, %zmm3 diff --git a/gas/testsuite/gas/i386/avx512vl-plain.l b/gas/testsuite/gas/i386/avx512vl-plain.l new file mode 100644 index 00000000000..447c615c98d --- /dev/null +++ b/gas/testsuite/gas/i386/avx512vl-plain.l @@ -0,0 +1,26 @@ +.*: Assembler messages: +.*:5: Error: .* +.*:6: Error: .* +.*:7: Error: .* +GAS LISTING .* + + +[ ]*1[ ]+\.text +[ ]*2[ ]+\.arch generic32 +[ ]*3[ ]+\.arch \.avx512vl +[ ]*4[ ]+_start: +[ ]*5[ ]+\{evex\} vaesenc[ ]+%ymm1, %ymm2, %ymm3 +[ ]*6[ ]+vgf2p8mulb[ ]+%ymm1, %ymm2, %ymm3\{%k4\} +[ ]*7[ ]+\{evex\} vpclmulqdq[ ]+\$0, %ymm1, %ymm2, %ymm3 +[ ]*8[ ]* +[ ]*9[ ]+\.arch \.vaes +[ ]*10[ ]+\?\?\?\? 62F26D28[ ]+\{evex\} vaesenc[ ]+%ymm1, %ymm2, %ymm3 +[ ]*10[ ]+DCD9 +[ ]*11[ ]* +[ ]*12[ ]+\.arch \.gfni +[ ]*13[ ]+\?\?\?\? 62F26D2C[ ]+vgf2p8mulb[ ]+%ymm1, %ymm2, %ymm3\{%k4\} +[ ]*13[ ]+CFD9 +[ ]*14[ ]* +[ ]*15[ ]+\.arch \.vpclmulqdq +[ ]*16[ ]+\?\?\?\? 62F36D28[ ]+\{evex\} vpclmulqdq[ ]+\$0, %ymm1, %ymm2, %ymm3 +[ ]*16[ ]+44D900 diff --git a/gas/testsuite/gas/i386/avx512vl-plain.s b/gas/testsuite/gas/i386/avx512vl-plain.s new file mode 100644 index 00000000000..711f13a9ef0 --- /dev/null +++ b/gas/testsuite/gas/i386/avx512vl-plain.s @@ -0,0 +1,16 @@ + .text + .arch generic32 + .arch .avx512vl +_start: + {evex} vaesenc %ymm1, %ymm2, %ymm3 + vgf2p8mulb %ymm1, %ymm2, %ymm3{%k4} + {evex} vpclmulqdq $0, %ymm1, %ymm2, %ymm3 + + .arch .vaes + {evex} vaesenc %ymm1, %ymm2, %ymm3 + + .arch .gfni + vgf2p8mulb %ymm1, %ymm2, %ymm3{%k4} + + .arch .vpclmulqdq + {evex} vpclmulqdq $0, %ymm1, %ymm2, %ymm3 diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp index b493914dcb7..cc7e59055b7 100644 --- a/gas/testsuite/gas/i386/i386.exp +++ b/gas/testsuite/gas/i386/i386.exp @@ -206,6 +206,7 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]] run_dump_test "avx512f-opts" run_dump_test "avx512f-opts-intel" run_dump_test "avx512f-nondef" + run_list_test "avx512f-plain" "-al" run_dump_test "avx512cd" run_dump_test "avx512cd-intel" run_dump_test "avx512er" @@ -246,6 +247,8 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]] run_list_test "arch-avx-1-4" "-march=generic32+avx+aes -I${srcdir}/$subdir -al" run_list_test "arch-avx-1-5" "-march=generic32+avx+pclmul -I${srcdir}/$subdir -al" run_list_test "arch-avx-1-6" "-march=generic32+aes+pclmul -I${srcdir}/$subdir -al" + run_list_test "arch-avx-1-7" "-march=generic32+gfni -I${srcdir}/$subdir -al" + run_list_test "arch-avx-1-8" "-march=generic32+avx+gfni -I${srcdir}/$subdir -al" run_dump_test "opts" run_dump_test "opts-intel" run_dump_test "sse2avx-opts" @@ -421,6 +424,7 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]] run_dump_test "pconfig-intel" run_list_test "avx512vl-1" "-al" run_list_test "avx512vl-2" "-al" + run_list_test "avx512vl-plain" "-al" run_dump_test "fpu-bad" run_dump_test "cet" run_dump_test "cet-intel"