Require another match for AVX512VL
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 25 May 2016 21:59:05 +0000 (14:59 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 25 May 2016 22:04:47 +0000 (15:04 -0700)
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
gas/config/tc-i386.c
gas/testsuite/gas/i386/avx512vl-1.l [new file with mode: 0644]
gas/testsuite/gas/i386/avx512vl-1.s [new file with mode: 0644]
gas/testsuite/gas/i386/avx512vl-2.l [new file with mode: 0644]
gas/testsuite/gas/i386/avx512vl-2.s [new file with mode: 0644]
gas/testsuite/gas/i386/i386.exp
gas/testsuite/gas/i386/x86-64-avx512vl-1.l [new file with mode: 0644]
gas/testsuite/gas/i386/x86-64-avx512vl-1.s [new file with mode: 0644]
gas/testsuite/gas/i386/x86-64-avx512vl-2.l [new file with mode: 0644]
gas/testsuite/gas/i386/x86-64-avx512vl-2.s [new file with mode: 0644]

index 2d23b4391ff4987cdf03ba816e92a3f6346d6db5..da0cdc08d0ffc4d19e6bc58fc736173a1511d847 100644 (file)
@@ -1,3 +1,19 @@
+2016-05-25  H.J. Lu  <hongjiu.lu@intel.com>
+
+       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  <hongjiu.lu@intel.com>
 
        PR gas/20141
index 13041ea70aa053f21881e9444525c0e80aa4625a..af94f72d7e63107397a42482448ef972c9c6bda0 100644 (file)
@@ -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 (file)
index 0000000..183c21d
--- /dev/null
@@ -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 (file)
index 0000000..62bae08
--- /dev/null
@@ -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 (file)
index 0000000..2f1f7b3
--- /dev/null
@@ -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 (file)
index 0000000..6a24a1f
--- /dev/null
@@ -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 
index 1aca467267e148d9711288ebb4d5631948017dd7..624674d0c26335abef1dd48fcd2c213ba9781c56 100644 (file)
@@ -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 (file)
index 0000000..c5982e7
--- /dev/null
@@ -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 (file)
index 0000000..8a5f2f9
--- /dev/null
@@ -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 (file)
index 0000000..10833f6
--- /dev/null
@@ -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 (file)
index 0000000..2b64c70
--- /dev/null
@@ -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