From 73b090a922a5f43931f0ec10b1b1b9507c819ebf Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 25 May 2016 14:59:05 -0700 Subject: [PATCH] Require another match for AVX512VL The AVX512VL bit alone isn't sufficient to select a 128-bit or 256-bit AVX512 instruction. We must match another AVX512 bit. PR gas/20140 * config/tc-i386.c (cpu_flags_match): Require another match for AVX512VL. * testsuite/gas/i386/i386.exp: Run avx512vl-1, avx512vl-2, x86-64-avx512vl-1 and x86-64-avx512vl-2. * testsuite/gas/i386/avx512vl-1.l: New file. * testsuite/gas/i386/avx512vl-1.s: Likewise. * testsuite/gas/i386/avx512vl-2.l: Likewise. * testsuite/gas/i386/avx512vl-2.s: Likewise. * testsuite/gas/i386/x86-64-avx512vl-1.l: Likewise. * testsuite/gas/i386/x86-64-avx512vl-1.s: Likewise. * testsuite/gas/i386/x86-64-avx512vl-2.l: Likewise. * testsuite/gas/i386/x86-64-avx512vl-2.s: Likewise. --- gas/ChangeLog | 16 +++++++++ gas/config/tc-i386.c | 15 +++++++++ gas/testsuite/gas/i386/avx512vl-1.l | 39 ++++++++++++++++++++++ gas/testsuite/gas/i386/avx512vl-1.s | 24 +++++++++++++ gas/testsuite/gas/i386/avx512vl-2.l | 27 +++++++++++++++ gas/testsuite/gas/i386/avx512vl-2.s | 15 +++++++++ gas/testsuite/gas/i386/i386.exp | 4 +++ gas/testsuite/gas/i386/x86-64-avx512vl-1.l | 39 ++++++++++++++++++++++ gas/testsuite/gas/i386/x86-64-avx512vl-1.s | 24 +++++++++++++ gas/testsuite/gas/i386/x86-64-avx512vl-2.l | 27 +++++++++++++++ gas/testsuite/gas/i386/x86-64-avx512vl-2.s | 15 +++++++++ 11 files changed, 245 insertions(+) create mode 100644 gas/testsuite/gas/i386/avx512vl-1.l create mode 100644 gas/testsuite/gas/i386/avx512vl-1.s create mode 100644 gas/testsuite/gas/i386/avx512vl-2.l create mode 100644 gas/testsuite/gas/i386/avx512vl-2.s create mode 100644 gas/testsuite/gas/i386/x86-64-avx512vl-1.l create mode 100644 gas/testsuite/gas/i386/x86-64-avx512vl-1.s create mode 100644 gas/testsuite/gas/i386/x86-64-avx512vl-2.l create mode 100644 gas/testsuite/gas/i386/x86-64-avx512vl-2.s diff --git a/gas/ChangeLog b/gas/ChangeLog index 2d23b4391ff..da0cdc08d0f 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,19 @@ +2016-05-25 H.J. Lu + + PR gas/20140 + * config/tc-i386.c (cpu_flags_match): Require another match + for AVX512VL. + * testsuite/gas/i386/i386.exp: Run avx512vl-1, avx512vl-2, + x86-64-avx512vl-1 and x86-64-avx512vl-2. + * testsuite/gas/i386/avx512vl-1.l: New file. + * testsuite/gas/i386/avx512vl-1.s: Likewise. + * testsuite/gas/i386/avx512vl-2.l: Likewise. + * testsuite/gas/i386/avx512vl-2.s: Likewise. + * testsuite/gas/i386/x86-64-avx512vl-1.l: Likewise. + * testsuite/gas/i386/x86-64-avx512vl-1.s: Likewise. + * testsuite/gas/i386/x86-64-avx512vl-2.l: Likewise. + * testsuite/gas/i386/x86-64-avx512vl-2.s: Likewise. + 2016-05-25 H.J. Lu PR gas/20141 diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 13041ea70aa..af94f72d7e6 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -1564,6 +1564,21 @@ cpu_flags_match (const insn_template *t) else match |= CPU_FLAGS_ARCH_MATCH; } + else if (x.bitfield.cpuavx512vl) + { + /* Match AVX512VL. */ + if (cpu.bitfield.cpuavx512vl) + { + /* Need another match. */ + cpu.bitfield.cpuavx512vl = 0; + if (!cpu_flags_all_zero (&cpu)) + match |= CPU_FLAGS_32BIT_MATCH; + else + match |= CPU_FLAGS_ARCH_MATCH; + } + else + match |= CPU_FLAGS_ARCH_MATCH; + } else match |= CPU_FLAGS_32BIT_MATCH; } diff --git a/gas/testsuite/gas/i386/avx512vl-1.l b/gas/testsuite/gas/i386/avx512vl-1.l new file mode 100644 index 00000000000..183c21dfc94 --- /dev/null +++ b/gas/testsuite/gas/i386/avx512vl-1.l @@ -0,0 +1,39 @@ +.*: Assembler messages: +.*:7: Error: .*bad register name.* +.*:8: Error: .*corei7\.avx.* +.*:9: Error: .*corei7\.avx.* +.*:10: Error: .*corei7\.avx.* +.*:15: Error: .*unsupported.* +.*:16: Error: .*unsupported.* +GAS LISTING .* +#... +[ ]*1[ ]+\.text +[ ]*2[ ]+\.arch corei7 +[ ]*3[ ]+_start: +[ ]*4[ ]+\.arch \.avx +[ ]*5[ ]+\?\?\?\? C5F9E711 vmovntdq %xmm2, \(%ecx\) +[ ]*6[ ]+\?\?\?\? C5FDE711 vmovntdq %ymm2, \(%ecx\) +[ ]*7[ ]+vmovntdq %zmm2, \(%ecx\) +[ ]*8[ ]+vpternlogq \$0xab, %xmm6, %xmm2, %xmm0 +[ ]*9[ ]+vpternlogq \$0xab, %ymm6, %ymm2, %ymm0 +[ ]*10[ ]+vpternlogq \$0xab, %zmm6, %zmm2, %zmm0 +[ ]*11[ ]+\.arch \.avx512f +[ ]*12[ ]+\?\?\?\? C5F9E701 vmovntdq %xmm0, \(%ecx\) +[ ]*13[ ]+\?\?\?\? C5FDE701 vmovntdq %ymm0, \(%ecx\) +[ ]*14[ ]+\?\?\?\? 62F17D48 vmovntdq %zmm0, \(%ecx\) +[ ]*14[ ]+E701 +[ ]*15[ ]+vpternlogq \$0xab, %xmm6, %xmm2, %xmm0 +[ ]*16[ ]+vpternlogq \$0xab, %ymm6, %ymm2, %ymm0 +[ ]*17[ ]+\?\?\?\? 62F3ED48 vpternlogq \$0xab, %zmm6, %zmm2, %zmm0 +[ ]*17[ ]+25C6AB +[ ]*18[ ]+\.arch \.avx512vl +[ ]*19[ ]+\?\?\?\? C5F9E701 vmovntdq %xmm0, \(%ecx\) +[ ]*20[ ]+\?\?\?\? C5FDE701 vmovntdq %ymm0, \(%ecx\) +[ ]*21[ ]+\?\?\?\? 62F17D48 vmovntdq %zmm0, \(%ecx\) +[ ]*21[ ]+E701 +[ ]*22[ ]+\?\?\?\? 62F3ED08 vpternlogq \$0xab, %xmm6, %xmm2, %xmm0 +[ ]*22[ ]+25C6AB +[ ]*23[ ]+\?\?\?\? 62F3ED28 vpternlogq \$0xab, %ymm6, %ymm2, %ymm0 +[ ]*23[ ]+25C6AB +[ ]*24[ ]+\?\?\?\? 62F3ED48 vpternlogq \$0xab, %zmm6, %zmm2, %zmm0 +[ ]*24[ ]+25C6AB diff --git a/gas/testsuite/gas/i386/avx512vl-1.s b/gas/testsuite/gas/i386/avx512vl-1.s new file mode 100644 index 00000000000..62bae08a429 --- /dev/null +++ b/gas/testsuite/gas/i386/avx512vl-1.s @@ -0,0 +1,24 @@ + .text + .arch corei7 +_start: + .arch .avx + vmovntdq %xmm2, (%ecx) + vmovntdq %ymm2, (%ecx) + vmovntdq %zmm2, (%ecx) + vpternlogq $0xab, %xmm6, %xmm2, %xmm0 + vpternlogq $0xab, %ymm6, %ymm2, %ymm0 + vpternlogq $0xab, %zmm6, %zmm2, %zmm0 + .arch .avx512f + vmovntdq %xmm0, (%ecx) + vmovntdq %ymm0, (%ecx) + vmovntdq %zmm0, (%ecx) + vpternlogq $0xab, %xmm6, %xmm2, %xmm0 + vpternlogq $0xab, %ymm6, %ymm2, %ymm0 + vpternlogq $0xab, %zmm6, %zmm2, %zmm0 + .arch .avx512vl + vmovntdq %xmm0, (%ecx) + vmovntdq %ymm0, (%ecx) + vmovntdq %zmm0, (%ecx) + vpternlogq $0xab, %xmm6, %xmm2, %xmm0 + vpternlogq $0xab, %ymm6, %ymm2, %ymm0 + vpternlogq $0xab, %zmm6, %zmm2, %zmm0 diff --git a/gas/testsuite/gas/i386/avx512vl-2.l b/gas/testsuite/gas/i386/avx512vl-2.l new file mode 100644 index 00000000000..2f1f7b37202 --- /dev/null +++ b/gas/testsuite/gas/i386/avx512vl-2.l @@ -0,0 +1,27 @@ +.*: Assembler messages: +.*:5: Error: .*corei7.* +.*:6: Error: .*corei7.* +.*:7: Error: .*corei7.* +.*:9: Error: .*corei7\.avx\.avx512vl.* +.*:10: Error: .*corei7\.avx\.avx512vl.* +.*:11: Error: .*corei7\.avx\.avx512vl.* +GAS LISTING .* +#... +[ ]*1[ ]+\.text +[ ]*2[ ]+\.arch corei7 +[ ]*3[ ]+_start: +[ ]*4[ ]+\.arch \.avx +[ ]*5[ ]+vpconflictd %xmm0, %xmm5 +[ ]*6[ ]+vpconflictd %ymm0, %ymm5 +[ ]*7[ ]+vpconflictd %ymm0, %zmm5 +[ ]*8[ ]+\.arch \.avx512vl +[ ]*9[ ]+vpconflictd %xmm0, %xmm5 +[ ]*10[ ]+vpconflictd %ymm0, %ymm5 +[ ]*11[ ]+vpconflictd %zmm0, %zmm5 +[ ]*12[ ]+\.arch \.avx512cd +[ ]*13[ ]+\?\?\?\? 62F27D08 vpconflictd %xmm0, %xmm5 +[ ]*13[ ]+C4E8 +[ ]*14[ ]+\?\?\?\? 62F27D28 vpconflictd %ymm0, %ymm5 +[ ]*14[ ]+C4E8 +[ ]*15[ ]+\?\?\?\? 62F27D48 vpconflictd %zmm0, %zmm5 +[ ]*15[ ]+C4E8 diff --git a/gas/testsuite/gas/i386/avx512vl-2.s b/gas/testsuite/gas/i386/avx512vl-2.s new file mode 100644 index 00000000000..6a24a1f1a0c --- /dev/null +++ b/gas/testsuite/gas/i386/avx512vl-2.s @@ -0,0 +1,15 @@ + .text + .arch corei7 +_start: + .arch .avx + vpconflictd %xmm0, %xmm5 + vpconflictd %ymm0, %ymm5 + vpconflictd %ymm0, %zmm5 + .arch .avx512vl + vpconflictd %xmm0, %xmm5 + vpconflictd %ymm0, %ymm5 + vpconflictd %zmm0, %zmm5 + .arch .avx512cd + vpconflictd %xmm0, %xmm5 + vpconflictd %ymm0, %ymm5 + vpconflictd %zmm0, %zmm5 diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp index 1aca467267e..624674d0c26 100644 --- a/gas/testsuite/gas/i386/i386.exp +++ b/gas/testsuite/gas/i386/i386.exp @@ -356,6 +356,8 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]] run_dump_test "ospke" run_dump_test "rdpid" run_dump_test "rdpid-intel" + run_list_test "avx512vl-1" "-al" + run_list_test "avx512vl-2" "-al" # These tests require support for 8 and 16 bit relocs, # so we only run them for ELF and COFF targets. @@ -754,6 +756,8 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t run_dump_test "x86-64-fence-as-lock-add-yes" run_dump_test "x86-64-fence-as-lock-add-no" run_dump_test "x86-64-pr20141" + run_list_test "x86-64-avx512vl-1" "-al" + run_list_test "x86-64-avx512vl-2" "-al" if { ![istarget "*-*-aix*"] && ![istarget "*-*-beos*"] diff --git a/gas/testsuite/gas/i386/x86-64-avx512vl-1.l b/gas/testsuite/gas/i386/x86-64-avx512vl-1.l new file mode 100644 index 00000000000..c5982e74312 --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-avx512vl-1.l @@ -0,0 +1,39 @@ +.*: Assembler messages: +.*:7: Error: .*bad register name.* +.*:8: Error: .*corei7\.avx.* +.*:9: Error: .*corei7\.avx.* +.*:10: Error: .*corei7\.avx.* +.*:15: Error: .*unsupported.* +.*:16: Error: .*unsupported.* +GAS LISTING .* +#... +[ ]*1[ ]+\.text +[ ]*2[ ]+\.arch corei7 +[ ]*3[ ]+_start: +[ ]*4[ ]+\.arch \.avx +[ ]*5[ ]+\?\?\?\? C5F9E711 vmovntdq %xmm2, \(%rcx\) +[ ]*6[ ]+\?\?\?\? C5FDE711 vmovntdq %ymm2, \(%rcx\) +[ ]*7[ ]+vmovntdq %zmm2, \(%rcx\) +[ ]*8[ ]+vpternlogq \$0xab, %xmm16, %xmm2, %xmm0 +[ ]*9[ ]+vpternlogq \$0xab, %ymm16, %ymm2, %ymm0 +[ ]*10[ ]+vpternlogq \$0xab, %zmm16, %zmm2, %zmm0 +[ ]*11[ ]+\.arch \.avx512f +[ ]*12[ ]+\?\?\?\? C5F9E701 vmovntdq %xmm0, \(%rcx\) +[ ]*13[ ]+\?\?\?\? C5FDE701 vmovntdq %ymm0, \(%rcx\) +[ ]*14[ ]+\?\?\?\? 62F17D48 vmovntdq %zmm0, \(%rcx\) +[ ]*14[ ]+E701 +[ ]*15[ ]+vpternlogq \$0xab, %xmm16, %xmm2, %xmm0 +[ ]*16[ ]+vpternlogq \$0xab, %ymm16, %ymm2, %ymm0 +[ ]*17[ ]+\?\?\?\? 62B3ED48 vpternlogq \$0xab, %zmm16, %zmm2, %zmm0 +[ ]*17[ ]+25C0AB +[ ]*18[ ]+\.arch \.avx512vl +[ ]*19[ ]+\?\?\?\? C5F9E701 vmovntdq %xmm0, \(%rcx\) +[ ]*20[ ]+\?\?\?\? C5FDE701 vmovntdq %ymm0, \(%rcx\) +[ ]*21[ ]+\?\?\?\? 62F17D48 vmovntdq %zmm0, \(%rcx\) +[ ]*21[ ]+E701 +[ ]*22[ ]+\?\?\?\? 62B3ED08 vpternlogq \$0xab, %xmm16, %xmm2, %xmm0 +[ ]*22[ ]+25C0AB +[ ]*23[ ]+\?\?\?\? 62B3ED28 vpternlogq \$0xab, %ymm16, %ymm2, %ymm0 +[ ]*23[ ]+25C0AB +[ ]*24[ ]+\?\?\?\? 62B3ED48 vpternlogq \$0xab, %zmm16, %zmm2, %zmm0 +[ ]*24[ ]+25C0AB diff --git a/gas/testsuite/gas/i386/x86-64-avx512vl-1.s b/gas/testsuite/gas/i386/x86-64-avx512vl-1.s new file mode 100644 index 00000000000..8a5f2f975c8 --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-avx512vl-1.s @@ -0,0 +1,24 @@ + .text + .arch corei7 +_start: + .arch .avx + vmovntdq %xmm2, (%rcx) + vmovntdq %ymm2, (%rcx) + vmovntdq %zmm2, (%rcx) + vpternlogq $0xab, %xmm16, %xmm2, %xmm0 + vpternlogq $0xab, %ymm16, %ymm2, %ymm0 + vpternlogq $0xab, %zmm16, %zmm2, %zmm0 + .arch .avx512f + vmovntdq %xmm0, (%rcx) + vmovntdq %ymm0, (%rcx) + vmovntdq %zmm0, (%rcx) + vpternlogq $0xab, %xmm16, %xmm2, %xmm0 + vpternlogq $0xab, %ymm16, %ymm2, %ymm0 + vpternlogq $0xab, %zmm16, %zmm2, %zmm0 + .arch .avx512vl + vmovntdq %xmm0, (%rcx) + vmovntdq %ymm0, (%rcx) + vmovntdq %zmm0, (%rcx) + vpternlogq $0xab, %xmm16, %xmm2, %xmm0 + vpternlogq $0xab, %ymm16, %ymm2, %ymm0 + vpternlogq $0xab, %zmm16, %zmm2, %zmm0 diff --git a/gas/testsuite/gas/i386/x86-64-avx512vl-2.l b/gas/testsuite/gas/i386/x86-64-avx512vl-2.l new file mode 100644 index 00000000000..10833f615f8 --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-avx512vl-2.l @@ -0,0 +1,27 @@ +.*: Assembler messages: +.*:5: Error: .*corei7.* +.*:6: Error: .*corei7.* +.*:7: Error: .*corei7.* +.*:9: Error: .*corei7\.avx\.avx512vl.* +.*:10: Error: .*corei7\.avx\.avx512vl.* +.*:11: Error: .*corei7\.avx\.avx512vl.* +GAS LISTING .* +#... +[ ]*1[ ]+\.text +[ ]*2[ ]+\.arch corei7 +[ ]*3[ ]+_start: +[ ]*4[ ]+\.arch \.avx +[ ]*5[ ]+vpconflictd %xmm0, %xmm25 +[ ]*6[ ]+vpconflictd %ymm0, %ymm25 +[ ]*7[ ]+vpconflictd %ymm0, %zmm25 +[ ]*8[ ]+\.arch \.avx512vl +[ ]*9[ ]+vpconflictd %xmm0, %xmm25 +[ ]*10[ ]+vpconflictd %ymm0, %ymm25 +[ ]*11[ ]+vpconflictd %zmm0, %zmm25 +[ ]*12[ ]+\.arch \.avx512cd +[ ]*13[ ]+\?\?\?\? 62627D08 vpconflictd %xmm0, %xmm25 +[ ]*13[ ]+C4C8 +[ ]*14[ ]+\?\?\?\? 62627D28 vpconflictd %ymm0, %ymm25 +[ ]*14[ ]+C4C8 +[ ]*15[ ]+\?\?\?\? 62627D48 vpconflictd %zmm0, %zmm25 +[ ]*15[ ]+C4C8 diff --git a/gas/testsuite/gas/i386/x86-64-avx512vl-2.s b/gas/testsuite/gas/i386/x86-64-avx512vl-2.s new file mode 100644 index 00000000000..2b64c702bf3 --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-avx512vl-2.s @@ -0,0 +1,15 @@ + .text + .arch corei7 +_start: + .arch .avx + vpconflictd %xmm0, %xmm25 + vpconflictd %ymm0, %ymm25 + vpconflictd %ymm0, %zmm25 + .arch .avx512vl + vpconflictd %xmm0, %xmm25 + vpconflictd %ymm0, %ymm25 + vpconflictd %zmm0, %zmm25 + .arch .avx512cd + vpconflictd %xmm0, %xmm25 + vpconflictd %ymm0, %ymm25 + vpconflictd %zmm0, %zmm25 -- 2.30.2