[1/3] x86: Add {load}/{store} tests for apx instructions.

Message ID 20240704085255.3279875-2-lili.cui@intel.com
State New
Headers
Series Add {load}/{store} tests for apx instructions |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_binutils_check--master-arm fail Patch failed to apply

Commit Message

Cui, Lili July 4, 2024, 8:52 a.m. UTC
  gas/ChangeLog:

        * testsuite/gas/i386/x86-64.exp: Add {load}/{store} tests for apx
	instructions.
        * testsuite/gas/i386/x86-64-pseudos-apx.d: New test.
        * testsuite/gas/i386/x86-64-pseudos-apx.s: Ditto.
---
 gas/testsuite/gas/i386/x86-64-pseudos-apx.d | 157 ++++++++++++++++++++
 gas/testsuite/gas/i386/x86-64-pseudos-apx.s |  45 ++++++
 gas/testsuite/gas/i386/x86-64.exp           |   1 +
 3 files changed, 203 insertions(+)
 create mode 100644 gas/testsuite/gas/i386/x86-64-pseudos-apx.d
 create mode 100644 gas/testsuite/gas/i386/x86-64-pseudos-apx.s
  

Comments

Jan Beulich July 4, 2024, 11:59 a.m. UTC | #1
On 04.07.2024 10:52, Cui, Lili wrote:
> --- /dev/null
> +++ b/gas/testsuite/gas/i386/x86-64-pseudos-apx.s
> @@ -0,0 +1,45 @@
> +# Check 64bit APX instructions with pseudo prefixes for encoding
> +
> +.text
> +_start:
> +        #APX REX2
> +        .irp m, mov, adc, add, and, cmp, or, sbb, sub, test, xor, xchg
> +        \m %ecx, %r31d
> +        {load}  \m %ecx, %r31d
> +        {store} \m %ecx, %r31d
> +        {load}  \m (%ecx), %r31d
> +        {store} \m %r31d, (%ecx)
> +        .endr
> +
> +        movaps (%r31),%xmm2
> +        {load} movaps (%r31),%xmm2
> +        {store} movaps %xmm2, (%r31)
> +
> +        #APX EVEX promoted from legacy
> +        .irp m, adc, add, and, or, sbb, sub, xor
> +        {evex}         \m %ecx, %r31d
> +        {evex} {load}  \m %ecx, %r31d
> +        {evex} {store} \m %ecx, %r31d
> +        {evex} {load}  \m (%ecx), %r31d
> +        {evex} {store} \m %r31d, (%ecx)
> +        .endr

While not as close to "promoted" as these, shouldn't CCMPcc be here, too? Or
wait - that's what the 2nd patch is about, I guess.

> +        #APX NDD
> +        .irp m, add, or, adc, sbb, and, sub, xor

Might be nice if, like further up, these then were also sorted alphabetically.
But I won't insist, it's just a little unexpected. IOW - feel free to put in
either way.

Jan
  
Cui, Lili July 5, 2024, 2:11 a.m. UTC | #2
> On 04.07.2024 10:52, Cui, Lili wrote:
> > --- /dev/null
> > +++ b/gas/testsuite/gas/i386/x86-64-pseudos-apx.s
> > @@ -0,0 +1,45 @@
> > +# Check 64bit APX instructions with pseudo prefixes for encoding
> > +
> > +.text
> > +_start:
> > +        #APX REX2
> > +        .irp m, mov, adc, add, and, cmp, or, sbb, sub, test, xor, xchg
> > +        \m %ecx, %r31d
> > +        {load}  \m %ecx, %r31d
> > +        {store} \m %ecx, %r31d
> > +        {load}  \m (%ecx), %r31d
> > +        {store} \m %r31d, (%ecx)
> > +        .endr
> > +
> > +        movaps (%r31),%xmm2
> > +        {load} movaps (%r31),%xmm2
> > +        {store} movaps %xmm2, (%r31)
> > +
> > +        #APX EVEX promoted from legacy
> > +        .irp m, adc, add, and, or, sbb, sub, xor
> > +        {evex}         \m %ecx, %r31d
> > +        {evex} {load}  \m %ecx, %r31d
> > +        {evex} {store} \m %ecx, %r31d
> > +        {evex} {load}  \m (%ecx), %r31d
> > +        {evex} {store} \m %r31d, (%ecx)
> > +        .endr
> 
> While not as close to "promoted" as these, shouldn't CCMPcc be here, too? Or
> wait - that's what the 2nd patch is about, I guess.
>
 
Yes. 

> > +        #APX NDD
> > +        .irp m, add, or, adc, sbb, and, sub, xor
> 
> Might be nice if, like further up, these then were also sorted alphabetically.
> But I won't insist, it's just a little unexpected. IOW - feel free to put in either
> way.
> 

Sorted them and submitted the patch.

Thanks,
Lili.
  

Patch

diff --git a/gas/testsuite/gas/i386/x86-64-pseudos-apx.d b/gas/testsuite/gas/i386/x86-64-pseudos-apx.d
new file mode 100644
index 00000000000..69c41cff2cb
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-pseudos-apx.d
@@ -0,0 +1,157 @@ 
+#as:
+#objdump: -dw -Msuffix
+#name: APX x86-64 pseudo prefixes
+
+.*: +file format .*
+
+Disassembly of section \.text:
+
+0+ <_start>:
+[	 ]*[a-f0-9]+:[	 ]*d5 11 89 cf[	 ]+movl   %ecx,%r31d
+[	 ]*[a-f0-9]+:[	 ]*d5 44 8b f9[	 ]+movl.s %ecx,%r31d
+[	 ]*[a-f0-9]+:[	 ]*d5 11 89 cf[	 ]+movl   %ecx,%r31d
+[	 ]*[a-f0-9]+:[	 ]*67 d5 44 8b 39[	 ]+movl   \(%ecx\),%r31d
+[	 ]*[a-f0-9]+:[	 ]*67 d5 44 89 39[	 ]+movl   %r31d,\(%ecx\)
+[	 ]*[a-f0-9]+:[	 ]*d5 11 11 cf[	 ]+adcl   %ecx,%r31d
+[	 ]*[a-f0-9]+:[	 ]*d5 44 13 f9[	 ]+adcl.s %ecx,%r31d
+[	 ]*[a-f0-9]+:[	 ]*d5 11 11 cf[	 ]+adcl   %ecx,%r31d
+[	 ]*[a-f0-9]+:[	 ]*67 d5 44 13 39[	 ]+adcl   \(%ecx\),%r31d
+[	 ]*[a-f0-9]+:[	 ]*67 d5 44 11 39[	 ]+adcl   %r31d,\(%ecx\)
+[	 ]*[a-f0-9]+:[	 ]*d5 11 01 cf[	 ]+addl   %ecx,%r31d
+[	 ]*[a-f0-9]+:[	 ]*d5 44 03 f9[	 ]+addl.s %ecx,%r31d
+[	 ]*[a-f0-9]+:[	 ]*d5 11 01 cf[	 ]+addl   %ecx,%r31d
+[	 ]*[a-f0-9]+:[	 ]*67 d5 44 03 39[	 ]+addl   \(%ecx\),%r31d
+[	 ]*[a-f0-9]+:[	 ]*67 d5 44 01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f0-9]+:[	 ]*62 dc 7c 08 31 cf[	 ]+xorl   %ecx,%r31d
+[	 ]*[a-f0-9]+:[	 ]*62 64 7c 08 33 f9[	 ]+xorl.s %ecx,%r31d
+[	 ]*[a-f0-9]+:[	 ]*62 dc 7c 08 31 cf[	 ]+xorl   %ecx,%r31d
+[	 ]*[a-f0-9]+:[	 ]*67 62 64 7c 08 33 39[	 ]+xorl   \(%ecx\),%r31d
+[	 ]*[a-f0-9]+:[	 ]*67 62 64 7c 08 31 39[	 ]+xorl   %r31d,\(%ecx\)
+[	 ]*[a-f0-9]+:[	 ]*62 dc 7c 18 01 cf[	 ]+addl   %ecx,%r31d,%eax
+[	 ]*[a-f0-9]+:[	 ]*62 64 7c 18 03 f9[	 ]+addl.s %ecx,%r31d,%eax
+[	 ]*[a-f0-9]+:[	 ]*62 dc 7c 18 01 cf[	 ]+addl   %ecx,%r31d,%eax
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 01 38[	 ]+addq   %r31,\(%r8\),%r16
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 03 38[	 ]+addq   \(%r8\),%r31,%r16
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 01 38[	 ]+addq   %r31,\(%r8\),%r16
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 03 38[	 ]+addq   \(%r8\),%r31,%r16
+[	 ]*[a-f0-9]+:[	 ]*62 dc 7c 18 09 cf[	 ]+orl    %ecx,%r31d,%eax
+[	 ]*[a-f0-9]+:[	 ]*62 64 7c 18 0b f9[	 ]+orl.s  %ecx,%r31d,%eax
+[	 ]*[a-f0-9]+:[	 ]*62 dc 7c 18 09 cf[	 ]+orl    %ecx,%r31d,%eax
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 09 38[	 ]+orq    %r31,\(%r8\),%r16
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 0b 38[	 ]+orq    \(%r8\),%r31,%r16
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 09 38[	 ]+orq    %r31,\(%r8\),%r16
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 0b 38[	 ]+orq    \(%r8\),%r31,%r16
+[	 ]*[a-f0-9]+:[	 ]*62 dc 7c 18 11 cf[	 ]+adcl   %ecx,%r31d,%eax
+[	 ]*[a-f0-9]+:[	 ]*62 64 7c 18 13 f9[	 ]+adcl.s %ecx,%r31d,%eax
+[	 ]*[a-f0-9]+:[	 ]*62 dc 7c 18 11 cf[	 ]+adcl   %ecx,%r31d,%eax
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 11 38[	 ]+adcq   %r31,\(%r8\),%r16
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 13 38[	 ]+adcq   \(%r8\),%r31,%r16
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 11 38[	 ]+adcq   %r31,\(%r8\),%r16
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 13 38[	 ]+adcq   \(%r8\),%r31,%r16
+[	 ]*[a-f0-9]+:[	 ]*62 dc 7c 18 19 cf[	 ]+sbbl   %ecx,%r31d,%eax
+[	 ]*[a-f0-9]+:[	 ]*62 64 7c 18 1b f9[	 ]+sbbl.s %ecx,%r31d,%eax
+[	 ]*[a-f0-9]+:[	 ]*62 dc 7c 18 19 cf[	 ]+sbbl   %ecx,%r31d,%eax
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 19 38[	 ]+sbbq   %r31,\(%r8\),%r16
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 1b 38[	 ]+sbbq   \(%r8\),%r31,%r16
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 19 38[	 ]+sbbq   %r31,\(%r8\),%r16
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 1b 38[	 ]+sbbq   \(%r8\),%r31,%r16
+[	 ]*[a-f0-9]+:[	 ]*62 dc 7c 18 21 cf[	 ]+andl   %ecx,%r31d,%eax
+[	 ]*[a-f0-9]+:[	 ]*62 64 7c 18 23 f9[	 ]+andl.s %ecx,%r31d,%eax
+[	 ]*[a-f0-9]+:[	 ]*62 dc 7c 18 21 cf[	 ]+andl   %ecx,%r31d,%eax
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 21 38[	 ]+andq   %r31,\(%r8\),%r16
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 23 38[	 ]+andq   \(%r8\),%r31,%r16
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 21 38[	 ]+andq   %r31,\(%r8\),%r16
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 23 38[	 ]+andq   \(%r8\),%r31,%r16
+[	 ]*[a-f0-9]+:[	 ]*62 dc 7c 18 29 cf[	 ]+subl   %ecx,%r31d,%eax
+[	 ]*[a-f0-9]+:[	 ]*62 64 7c 18 2b f9[	 ]+subl.s %ecx,%r31d,%eax
+[	 ]*[a-f0-9]+:[	 ]*62 dc 7c 18 29 cf[	 ]+subl   %ecx,%r31d,%eax
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 29 38[	 ]+subq   %r31,\(%r8\),%r16
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 2b 38[	 ]+subq   \(%r8\),%r31,%r16
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 29 38[	 ]+subq   %r31,\(%r8\),%r16
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 2b 38[	 ]+subq   \(%r8\),%r31,%r16
+[	 ]*[a-f0-9]+:[	 ]*62 dc 7c 18 31 cf[	 ]+xorl   %ecx,%r31d,%eax
+[	 ]*[a-f0-9]+:[	 ]*62 64 7c 18 33 f9[	 ]+xorl.s %ecx,%r31d,%eax
+[	 ]*[a-f0-9]+:[	 ]*62 dc 7c 18 31 cf[	 ]+xorl   %ecx,%r31d,%eax
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 31 38[	 ]+xorq   %r31,\(%r8\),%r16
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 33 38[	 ]+xorq   \(%r8\),%r31,%r16
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 31 38[	 ]+xorq   %r31,\(%r8\),%r16
+[	 ]*[a-f0-9]+:[	 ]*62 44 fc 10 33 38[	 ]+xorq   \(%r8\),%r31,%r16
+[	 ]*[a-f0-9]+:[	 ]*62 f4 7c 08 42 c2[	 ]+cfcmovbl %edx,%eax
+[	 ]*[a-f0-9]+:[	 ]*62 f4 7c 08 42 c2[	 ]+cfcmovbl %edx,%eax
+[	 ]*[a-f0-9]+:[	 ]*62 f4 7c 0c 42 d0[	 ]+cfcmovbl.s %edx,%eax
+[	 ]*[a-f0-9]+:[	 ]*67 62 f4 7c 08 42 02[	 ]+cfcmovbl \(%edx\),%eax
+[	 ]*[a-f0-9]+:[	 ]*67 62 f4 7c 0c 42 02[	 ]+cfcmovbl %eax,\(%edx\)
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-pseudos-apx.s b/gas/testsuite/gas/i386/x86-64-pseudos-apx.s
new file mode 100644
index 00000000000..3dc1f17c8db
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-pseudos-apx.s
@@ -0,0 +1,45 @@ 
+# Check 64bit APX instructions with pseudo prefixes for encoding
+
+.text
+_start:
+        #APX REX2
+        .irp m, mov, adc, add, and, cmp, or, sbb, sub, test, xor, xchg
+        \m %ecx, %r31d
+        {load}  \m %ecx, %r31d
+        {store} \m %ecx, %r31d
+        {load}  \m (%ecx), %r31d
+        {store} \m %r31d, (%ecx)
+        .endr
+
+        movaps (%r31),%xmm2
+        {load} movaps (%r31),%xmm2
+        {store} movaps %xmm2, (%r31)
+
+        #APX EVEX promoted from legacy
+        .irp m, adc, add, and, or, sbb, sub, xor
+        {evex}         \m %ecx, %r31d
+        {evex} {load}  \m %ecx, %r31d
+        {evex} {store} \m %ecx, %r31d
+        {evex} {load}  \m (%ecx), %r31d
+        {evex} {store} \m %r31d, (%ecx)
+        .endr
+
+        #APX NDD
+        .irp m, add, or, adc, sbb, and, sub, xor
+        \m %ecx, %r31d, %eax
+        {load}  \m %ecx, %r31d, %eax
+        {store} \m %ecx, %r31d, %eax
+        {load}  \m %r31,(%r8),%r16
+        {load}  \m (%r8),%r31,%r16
+        {store} \m %r31,(%r8),%r16
+        {store} \m (%r8),%r31,%r16
+        .endr
+
+        #APX News.
+        .irp m, cfcmovb
+        \m %edx, %eax
+        {load}  \m %edx, %eax
+        {store} \m %edx, %eax
+        {load}  \m (%edx), %eax
+        {store} \m %eax, (%edx)
+        .endr
diff --git a/gas/testsuite/gas/i386/x86-64.exp b/gas/testsuite/gas/i386/x86-64.exp
index bd1aa549585..7562291516c 100644
--- a/gas/testsuite/gas/i386/x86-64.exp
+++ b/gas/testsuite/gas/i386/x86-64.exp
@@ -559,6 +559,7 @@  run_dump_test "x86-64-cet-intel"
 run_list_test "x86-64-cet-ibt-inval"
 run_list_test "x86-64-cet-shstk-inval"
 run_dump_test "x86-64-pseudos"
+run_dump_test "x86-64-pseudos-apx"
 run_list_test "x86-64-pseudos-bad"
 run_list_test "x86-64-inval-pseudo" "-al"
 run_dump_test "x86-64-notrack"