diff options
author | Jan Beulich <jbeulich@suse.com> | 2024-06-21 14:40:44 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2024-06-21 14:40:44 +0200 |
commit | f4a966a91d23ae78000d577665502edff7274fd9 (patch) | |
tree | 39003f6ed23e61899ec60657a8af6492d1f363d7 /gas/testsuite | |
parent | fa2c4239f1ab70b198f6d404f727d0d744221595 (diff) | |
download | gdb-f4a966a91d23ae78000d577665502edff7274fd9.zip gdb-f4a966a91d23ae78000d577665502edff7274fd9.tar.gz gdb-f4a966a91d23ae78000d577665502edff7274fd9.tar.bz2 |
x86: optimize {,V}PEXTR{D,Q} with immediate of 0
Such are equivalent to simple moves, which are up to 3 bytes shorter to
encode (and perhaps also cheaper to execute).
Diffstat (limited to 'gas/testsuite')
-rw-r--r-- | gas/testsuite/gas/i386/optimize-1.d | 4 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/optimize-1.s | 5 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/optimize-1a.d | 4 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/optimize-4.d | 4 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/optimize-5.d | 4 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/x86-64-optimize-pextr.d | 29 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/x86-64-optimize-pextr.l | 41 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/x86-64-optimize-pextr.s | 27 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/x86-64.exp | 2 |
9 files changed, 120 insertions, 0 deletions
diff --git a/gas/testsuite/gas/i386/optimize-1.d b/gas/testsuite/gas/i386/optimize-1.d index 23d715c..f496846 100644 --- a/gas/testsuite/gas/i386/optimize-1.d +++ b/gas/testsuite/gas/i386/optimize-1.d @@ -162,6 +162,10 @@ Disassembly of section .text: +[a-f0-9]+: 66 .* pxor %xmm2,%xmm2 +[a-f0-9]+: c5 .* vpxor %xmm2,%xmm2,%xmm0 +[a-f0-9]+: c5 .* vpxor %ymm2,%ymm2,%ymm0 + +[a-f0-9]+: 66 .* movd %xmm1,%edx + +[a-f0-9]+: 66 .* movd %xmm1,\(%edx\) + +[a-f0-9]+: c5 .* vmovd %xmm1,%edx + +[a-f0-9]+: c5 .* vmovd %xmm1,\(%edx\) +[a-f0-9]+: 0f ba e0 0f bt \$0xf,%eax +[a-f0-9]+: 66 0f ba e0 10 bt \$0x10,%ax +[a-f0-9]+: 0f ba f8 0f btc \$0xf,%eax diff --git a/gas/testsuite/gas/i386/optimize-1.s b/gas/testsuite/gas/i386/optimize-1.s index f80301d..ce53758 100644 --- a/gas/testsuite/gas/i386/optimize-1.s +++ b/gas/testsuite/gas/i386/optimize-1.s @@ -189,6 +189,11 @@ _start: vpcmpgtq %xmm2, %xmm2, %xmm0 vpcmpgtq %ymm2, %ymm2, %ymm0 + pextrd $0, %xmm1, %edx + pextrd $0, %xmm1, (%edx) + vpextrd $0, %xmm1, %edx + vpextrd $0, %xmm1, (%edx) + bt $15, %ax bt $16, %ax btc $15, %ax diff --git a/gas/testsuite/gas/i386/optimize-1a.d b/gas/testsuite/gas/i386/optimize-1a.d index 33c647b..b039a0d 100644 --- a/gas/testsuite/gas/i386/optimize-1a.d +++ b/gas/testsuite/gas/i386/optimize-1a.d @@ -163,6 +163,10 @@ Disassembly of section .text: +[a-f0-9]+: 66 .* pxor %xmm2,%xmm2 +[a-f0-9]+: c5 .* vpxor %xmm2,%xmm2,%xmm0 +[a-f0-9]+: c5 .* vpxor %ymm2,%ymm2,%ymm0 + +[a-f0-9]+: 66 .* movd %xmm1,%edx + +[a-f0-9]+: 66 .* movd %xmm1,\(%edx\) + +[a-f0-9]+: c5 .* vmovd %xmm1,%edx + +[a-f0-9]+: c5 .* vmovd %xmm1,\(%edx\) +[a-f0-9]+: 0f ba e0 0f bt \$0xf,%eax +[a-f0-9]+: 66 0f ba e0 10 bt \$0x10,%ax +[a-f0-9]+: 0f ba f8 0f btc \$0xf,%eax diff --git a/gas/testsuite/gas/i386/optimize-4.d b/gas/testsuite/gas/i386/optimize-4.d index fa9b95f..ea2c761 100644 --- a/gas/testsuite/gas/i386/optimize-4.d +++ b/gas/testsuite/gas/i386/optimize-4.d @@ -162,6 +162,10 @@ Disassembly of section .text: +[a-f0-9]+: 66 .* pxor %xmm2,%xmm2 +[a-f0-9]+: c5 .* vpxor %xmm2,%xmm2,%xmm0 +[a-f0-9]+: c5 .* vpxor %ymm2,%ymm2,%ymm0 + +[a-f0-9]+: 66 .* movd %xmm1,%edx + +[a-f0-9]+: 66 .* movd %xmm1,\(%edx\) + +[a-f0-9]+: c5 .* vmovd %xmm1,%edx + +[a-f0-9]+: c5 .* vmovd %xmm1,\(%edx\) +[a-f0-9]+: 0f ba e0 0f bt \$0xf,%eax +[a-f0-9]+: 66 0f ba e0 10 bt \$0x10,%ax +[a-f0-9]+: 0f ba f8 0f btc \$0xf,%eax diff --git a/gas/testsuite/gas/i386/optimize-5.d b/gas/testsuite/gas/i386/optimize-5.d index 36d0ba9..d53d2cc 100644 --- a/gas/testsuite/gas/i386/optimize-5.d +++ b/gas/testsuite/gas/i386/optimize-5.d @@ -162,6 +162,10 @@ Disassembly of section .text: +[a-f0-9]+: 66 .* pxor %xmm2,%xmm2 +[a-f0-9]+: c5 .* vpxor %xmm2,%xmm2,%xmm0 +[a-f0-9]+: c5 .* vpxor %ymm2,%ymm2,%ymm0 + +[a-f0-9]+: 66 .* movd %xmm1,%edx + +[a-f0-9]+: 66 .* movd %xmm1,\(%edx\) + +[a-f0-9]+: c5 .* vmovd %xmm1,%edx + +[a-f0-9]+: c5 .* vmovd %xmm1,\(%edx\) +[a-f0-9]+: 0f ba e0 0f bt \$0xf,%eax +[a-f0-9]+: 66 0f ba e0 10 bt \$0x10,%ax +[a-f0-9]+: 0f ba f8 0f btc \$0xf,%eax diff --git a/gas/testsuite/gas/i386/x86-64-optimize-pextr.d b/gas/testsuite/gas/i386/x86-64-optimize-pextr.d new file mode 100644 index 0000000..2b10b8a --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-optimize-pextr.d @@ -0,0 +1,29 @@ +#as: -O -msse2avx +#objdump: -drw +#name: x86-64 PEXTR optimized encoding with -msse2avx + +.*: +file format .* + + +Disassembly of section .text: + +0+ <pextr>: + +[a-f0-9]+: c5 f9 7e ca vmovd %xmm1,%edx + +[a-f0-9]+: c5 f9 7e 0a vmovd %xmm1,\(%rdx\) + +[a-f0-9]+: 62 f9 7d 08 7e ca vmovd %xmm1,%r18d + +[a-f0-9]+: 62 f9 7d 08 7e 0a vmovd %xmm1,\(%r18\) + +[a-f0-9]+: c5 f9 7e ca vmovd %xmm1,%edx + +[a-f0-9]+: c5 f9 7e 0a vmovd %xmm1,\(%rdx\) + +[a-f0-9]+: 62 e1 7d 08 7e ca vmovd %xmm17,%edx + +[a-f0-9]+: 62 f9 7d 08 7e ca vmovd %xmm1,%r18d + +[a-f0-9]+: 62 f9 7d 08 7e 0a vmovd %xmm1,\(%r18\) + +[a-f0-9]+: c4 e1 f9 7e ca vmovq %xmm1,%rdx + +[a-f0-9]+: c5 f9 d6 0a vmovq %xmm1,\(%rdx\) + +[a-f0-9]+: 62 f9 fd 08 7e ca vmovq %xmm1,%r18 + +[a-f0-9]+: 62 f9 fd 08 7e 0a vmovq %xmm1,\(%r18\) + +[a-f0-9]+: c4 e1 f9 7e ca vmovq %xmm1,%rdx + +[a-f0-9]+: c5 f9 d6 0a vmovq %xmm1,\(%rdx\) + +[a-f0-9]+: 62 e1 fd 08 7e ca vmovq %xmm17,%rdx + +[a-f0-9]+: 62 f9 fd 08 7e ca vmovq %xmm1,%r18 + +[a-f0-9]+: 62 f9 fd 08 7e 0a vmovq %xmm1,\(%r18\) +#pass diff --git a/gas/testsuite/gas/i386/x86-64-optimize-pextr.l b/gas/testsuite/gas/i386/x86-64-optimize-pextr.l new file mode 100644 index 0000000..84e305a --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-optimize-pextr.l @@ -0,0 +1,41 @@ +.*: Assembler messages: +.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?\?\? C4E1F97E[ ]+vpextrq \$0, %xmm1, %rdx +[ ]*[0-9a-f]+[ ]+CA +[ ]*[0-9a-f]+[ ]+\?\?\?\? C5F9D60A[ ]+vpextrq \$0, %xmm1, \(%rdx\) +[ ]*[0-9a-f]+[ ]+ +[ ]*[0-9a-f]+[ ]+\?\?\?\? 62E1FD08[ ]+vpextrq \$0, %xmm17, %rdx +[ ]*[0-9a-f]+[ ]+7ECA +[ ]*[0-9a-f]+[ ]+\?\?\?\? 62F9FD08[ ]+vpextrq \$0, %xmm1, %r18 +[ ]*[0-9a-f]+[ ]+7ECA +[ ]*[0-9a-f]+[ ]+\?\?\?\? 62F9FD08[ ]+vpextrq \$0, %xmm1, \(%r18\) +[ ]*[0-9a-f]+[ ]+7E0A +#pass diff --git a/gas/testsuite/gas/i386/x86-64-optimize-pextr.s b/gas/testsuite/gas/i386/x86-64-optimize-pextr.s new file mode 100644 index 0000000..7ec1605 --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-optimize-pextr.s @@ -0,0 +1,27 @@ + .text +pextr: + pextrd $0, %xmm1, %edx + pextrd $0, %xmm1, (%rdx) + + pextrd $0, %xmm1, %r18d + pextrd $0, %xmm1, (%r18) + + vpextrd $0, %xmm1, %edx + vpextrd $0, %xmm1, (%rdx) + + vpextrd $0, %xmm17, %edx + vpextrd $0, %xmm1, %r18d + vpextrd $0, %xmm1, (%r18) + + pextrq $0, %xmm1, %rdx + pextrq $0, %xmm1, (%rdx) + + pextrq $0, %xmm1, %r18 + pextrq $0, %xmm1, (%r18) + + vpextrq $0, %xmm1, %rdx + vpextrq $0, %xmm1, (%rdx) + + vpextrq $0, %xmm17, %rdx + vpextrq $0, %xmm1, %r18 + vpextrq $0, %xmm1, (%r18) diff --git a/gas/testsuite/gas/i386/x86-64.exp b/gas/testsuite/gas/i386/x86-64.exp index a8d49ce..b9eedbe 100644 --- a/gas/testsuite/gas/i386/x86-64.exp +++ b/gas/testsuite/gas/i386/x86-64.exp @@ -583,6 +583,8 @@ run_dump_test "x86-64-optimize-6" run_list_test "x86-64-optimize-7a" "-I${srcdir}/$subdir -march=+noavx -al" run_dump_test "x86-64-optimize-7b" run_list_test "x86-64-optimize-8" "-I${srcdir}/$subdir -march=+noavx2 -al" +run_list_test "x86-64-optimize-pextr" "-O -aln" +run_dump_test "x86-64-optimize-pextr" run_dump_test "x86-64-apx-ndd-optimize" run_dump_test "x86-64-align-branch-1a" run_dump_test "x86-64-align-branch-1b" |