xref: /llvm-project/llvm/test/CodeGen/X86/apx/compress-evex.mir (revision 28a3fbbe8c6cd5b92fb0a2a3cc21a836a381e086)
1# RUN: llc %s -mtriple=x86_64-unknown -mattr=+ndd,+egpr -start-before=x86-compress-evex -show-mc-encoding -o - | FileCheck --check-prefixes=CHECK,NDD %s
2# RUN: llc %s -mtriple=x86_64-unknown -mattr=+ndd,+egpr,+nf -start-before=x86-compress-evex -show-mc-encoding -o - | FileCheck --check-prefixes=CHECK,NDD-NF %s
3
4...
5---
6name:            ndd_2_non_ndd_xor
7body:             |
8  bb.0.entry:
9    liveins: $rdi, $rsi
10    ; CHECK: xorq    %rsi, %rax                      # EVEX TO LEGACY Compression encoding: [0x48,0x31,0xf0]
11    renamable $rax = ADD64rr_ND killed renamable $rdi, renamable $rsi, implicit-def dead $eflags
12    renamable $rax = XOR64rr_ND killed renamable $rax, killed renamable $rsi, implicit-def dead $eflags
13    RET64 $rax
14...
15---
16name:            ndd_2_non_ndd_sub
17body:             |
18  bb.0.entry:
19    liveins: $rdi, $rsi
20    ; CHECK: subq    %rsi, %rax                      # EVEX TO LEGACY Compression encoding: [0x48,0x29,0xf0]
21    renamable $rax = ADD64rr_ND killed renamable $rdi, renamable $rsi, implicit-def dead $eflags
22    renamable $rax = SUB64rr_ND killed renamable $rax, killed renamable $rsi, implicit-def dead $eflags
23    RET64 $rax
24...
25---
26name:            ndd_2_non_ndd_commutable
27body:             |
28  bb.0.entry:
29    liveins: $rdi, $rsi
30    ; CHECK: xorq    %rsi, %rax                      # EVEX TO LEGACY Compression encoding: [0x48,0x31,0xf0]
31    renamable $rax = ADD64rr_ND killed renamable $rdi, renamable $rsi, implicit-def dead $eflags
32    renamable $rax = XOR64rr_ND killed renamable $rsi, killed renamable $rax, implicit-def dead $eflags
33    RET64 $rax
34...
35---
36name:            ndd_2_non_ndd_commutable_new_opcode
37body:             |
38  bb.0.entry:
39    liveins: $rdi, $rsi
40    ; CHECK: shldq   $52, %rsi, %rax                 # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0xa4,0xf0,0x34]
41    renamable $rax = ADD64rr_ND killed renamable $rdi, renamable $rsi, implicit-def dead $eflags
42    renamable $rax = SHRD64rri8_ND killed renamable $rsi, killed renamable $rax, 12, implicit-def dead $eflags
43    RET64 $rax
44...
45---
46name:            ndd_2_non_ndd_incommutable
47body:             |
48  bb.0.entry:
49    liveins: $rdi, $rsi
50    ; NDD:     subq    %rax, %rsi, %rax              # encoding: [0x62,0xf4,0xfc,0x18,0x29,0xc6]
51    ; NDD-NF: {nf} subq    %rax, %rsi, %rax          # EVEX TO EVEX Compression encoding: [0x62,0xf4,0xfc,0x1c,0x29,0xc6]
52    renamable $rax = ADD64rr_ND killed renamable $rdi, renamable $rsi, implicit-def dead $eflags
53    renamable $rax = SUB64rr_ND killed renamable $rsi, killed renamable $rax, implicit-def dead $eflags
54    RET64 $rax
55...
56---
57name:            ndd_2_non_ndd_mem
58body:             |
59  bb.0.entry:
60    ; NDD:    addq    $123456, (%rax), %rax          # encoding: [0x62,0xf4,0xfc,0x18,0x81,0x00,0x40,0xe2,0x01,0x00]
61    ; NDD-NF: {nf} addq $123456, (%rax), %rax        # EVEX TO EVEX Compression encoding: [0x62,0xf4,0xfc,0x1c,0x81,0x00,0x40,0xe2,0x01,0x00]
62    renamable $rax = MOV64rm $noreg, 1, $noreg, 0, $fs
63    renamable $rax = nsw ADD64mi32_ND killed renamable $rax, 1, $noreg, 0, $noreg, 123456, implicit-def dead $eflags
64    RET64 $rax
65...
66---
67name:            ndd_2_non_ndd_egpr
68body:             |
69  bb.0.entry:
70    liveins: $rdi, $r16
71    ; CHECK: xorq    %r16, %rax                      # EVEX TO LEGACY Compression encoding: [0xd5,0x48,0x31,0xc0]
72    renamable $rax = ADD64rr_ND killed renamable $rdi, renamable $r16, implicit-def dead $eflags
73    renamable $rax = XOR64rr_ND killed renamable $rax, killed renamable $r16, implicit-def dead $eflags
74    RET64 $rax
75...
76---
77name:            ndd_2_non_ndd_egpr_nf
78body:             |
79  bb.0.entry:
80    liveins: $rdi, $r16
81    ; CHECK: {nf} xorq %r16, %rax                   # EVEX TO EVEX Compression encoding: [0x62,0xe4,0xfc,0x0c,0x31,0xc0]
82    renamable $rax = ADD64rr_ND killed renamable $rdi, renamable $r16, implicit-def dead $eflags
83    renamable $rax = XOR64rr_NF_ND killed renamable $rax, killed renamable $r16
84    RET64 $rax
85...
86---
87name:            bswapr_to_movberr
88body:             |
89  bb.0.entry:
90    liveins: $rax
91    ; CHECK: bswapq  %rax                            # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0xc8]
92    renamable $rax = MOVBE64rr killed renamable $rax
93    RET64 killed $rax
94...
95---
96name:            non_nf_2_nf
97body:             |
98  bb.0.entry:
99    liveins: $rdi, $r16
100    ; CHECK:  addq %r16, %rdi                        # encoding: [0xd5,0x48,0x01,0xc7]
101    ; NDD:    xorq %r16, %rdi, %rax                  # encoding: [0x62,0xe4,0xfc,0x18,0x31,0xc7]
102    ; NDD-NF: {nf} xorq %r16, %rdi, %rax             # EVEX TO EVEX Compression encoding: [0x62,0xe4,0xfc,0x1c,0x31,0xc7]
103    ; CHECK:  addq %r16, %rax, %rdi                  # encoding: [0x62,0xe4,0xc4,0x18,0x01,0xc0]
104    ; CHECK:  adcq %rdi, %r16, %rax                  # encoding: [0x62,0xfc,0xfc,0x18,0x11,0xf8]
105    $rdi = ADD64rr $rdi, $r16, implicit-def dead $eflags
106    $rax = XOR64rr_ND $rdi, $r16, implicit-def dead $eflags
107    $rdi = ADD64rr_ND $rax, $r16, implicit-def $eflags
108    $rax = ADC64rr_ND $r16, $rdi, implicit-def dead $eflags, implicit $eflags
109    RET64 $rax
110...
111---
112name:            cfcmov_no_convert
113body:             |
114  bb.0.entry:
115    liveins: $eflags, $rax, $rbx
116    ; CHECK: cfcmovew %bx, %ax, %ax                  # encoding: [0x62,0xf4,0x7d,0x1c,0x44,0xc3]
117    ; CHECK: cfcmovsw 24(%rax), %bx, %bx             # encoding: [0x62,0xf4,0x65,0x1c,0x48,0x58,0x18]
118    ; CHECK: cfcmovel %ebx, %eax, %eax               # encoding: [0x62,0xf4,0x7c,0x1c,0x44,0xc3]
119    ; CHECK: cfcmovsl 24(%rax), %ebx, %ebx           # encoding: [0x62,0xf4,0x64,0x1c,0x48,0x58,0x18]
120    ; CHECK: cfcmoveq %rbx, %rax, %rax               # encoding: [0x62,0xf4,0xfc,0x1c,0x44,0xc3]
121    ; CHECK: cfcmovsq 24(%rax), %rbx, %rbx           # encoding: [0x62,0xf4,0xe4,0x1c,0x48,0x58,0x18]
122    $ax = CFCMOV16rr_ND $ax, $bx, 4, implicit $eflags
123    $bx = CFCMOV16rm_ND $bx, $rax, 1, $noreg, 24, $noreg, 8, implicit $eflags
124    $eax = CFCMOV32rr_ND $eax, $ebx, 4, implicit $eflags
125    $ebx = CFCMOV32rm_ND $ebx, $rax, 1, $noreg, 24, $noreg, 8, implicit $eflags
126    $rax = CFCMOV64rr_ND $rax, $rbx, 4, implicit $eflags
127    $rbx = CFCMOV64rm_ND $rbx, $rax, 1, $noreg, 24, $noreg, 8, implicit $eflags
128    RET64 $rax
129...
130---
131name:            no_convert_8bit_16bit
132body:             |
133  bb.0.entry:
134    liveins: $di, $si, $ax
135    ; CHECK: addb    %sil, %dil                      # EVEX TO LEGACY Compression encoding: [0x40,0x00,0xf7]
136    ; CHECK: xorw    %di, %ax                        # EVEX TO LEGACY Compression encoding: [0x66,0x31,0xf8]
137    $dil = ADD8rr_ND $dil, killed $sil, implicit-def dead $eflags
138    $ax = XOR16rr_ND $ax, killed $di, implicit-def dead $eflags
139    RET64 $rax
140...
141