Skip to content

Commit a27842c

Browse files
authored
[X86][NFC] Add -show-mc-encoding to check register misuse (#169264)
1 parent e575539 commit a27842c

File tree

4 files changed

+91
-91
lines changed

4 files changed

+91
-91
lines changed

llvm/test/CodeGen/X86/apx/no-rex2-general.ll

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
2-
; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+sse2,+ssse3,+egpr | FileCheck %s --check-prefixes=CHECK,SSE
3-
; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+sse2,+ssse3,+egpr,+avx | FileCheck %s --check-prefixes=CHECK,AVX
2+
; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+sse2,+ssse3,+egpr --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,SSE
3+
; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+sse2,+ssse3,+egpr,+avx --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,AVX
44

55
define i32 @map0(ptr nocapture noundef readonly %a, i64 noundef %b) {
66
; CHECK-LABEL: map0:
77
; CHECK: # %bb.0: # %entry
8-
; CHECK-NEXT: movq %rsi, %r16
9-
; CHECK-NEXT: movq %rdi, %r17
8+
; CHECK-NEXT: movq %rsi, %r16 # encoding: [0xd5,0x18,0x89,0xf0]
9+
; CHECK-NEXT: movq %rdi, %r17 # encoding: [0xd5,0x18,0x89,0xf9]
1010
; CHECK-NEXT: #APP
11-
; CHECK-NEXT: nop
11+
; CHECK-NEXT: nop # encoding: [0x90]
1212
; CHECK-NEXT: #NO_APP
13-
; CHECK-NEXT: movl (%r17,%r16,4), %eax
14-
; CHECK-NEXT: retq
13+
; CHECK-NEXT: movl (%r17,%r16,4), %eax # encoding: [0xd5,0x30,0x8b,0x04,0x81]
14+
; CHECK-NEXT: retq # encoding: [0xc3]
1515
entry:
1616
%add.ptr = getelementptr inbounds i32, ptr %a, i64 %b
1717
tail call void asm sideeffect "nop", "~{eax},~{ecx},~{edx},~{esi},~{edi},~{r8},~{r9},~{r10},~{r11}"()
@@ -22,23 +22,23 @@ entry:
2222
define i32 @map1_or_vex(<2 x double> noundef %a) nounwind {
2323
; SSE-LABEL: map1_or_vex:
2424
; SSE: # %bb.0: # %entry
25-
; SSE-NEXT: cvtsd2si %xmm0, %r16d
25+
; SSE-NEXT: cvtsd2si %xmm0, %r16d # encoding: [0xf2,0xd5,0xc0,0x2d,0xc0]
2626
; SSE-NEXT: #APP
27-
; SSE-NEXT: nop
27+
; SSE-NEXT: nop # encoding: [0x90]
2828
; SSE-NEXT: #NO_APP
29-
; SSE-NEXT: movl %r16d, %eax
30-
; SSE-NEXT: retq
29+
; SSE-NEXT: movl %r16d, %eax # encoding: [0xd5,0x40,0x89,0xc0]
30+
; SSE-NEXT: retq # encoding: [0xc3]
3131
;
3232
; AVX-LABEL: map1_or_vex:
3333
; AVX: # %bb.0: # %entry
34-
; AVX-NEXT: pushq %rbx
35-
; AVX-NEXT: vcvtsd2si %xmm0, %ebx
34+
; AVX-NEXT: pushq %rbx # encoding: [0x53]
35+
; AVX-NEXT: vcvtsd2si %xmm0, %ebx # encoding: [0xc5,0xfb,0x2d,0xd8]
3636
; AVX-NEXT: #APP
37-
; AVX-NEXT: nop
37+
; AVX-NEXT: nop # encoding: [0x90]
3838
; AVX-NEXT: #NO_APP
39-
; AVX-NEXT: movl %ebx, %eax
40-
; AVX-NEXT: popq %rbx
41-
; AVX-NEXT: retq
39+
; AVX-NEXT: movl %ebx, %eax # encoding: [0x89,0xd8]
40+
; AVX-NEXT: popq %rbx # encoding: [0x5b]
41+
; AVX-NEXT: retq # encoding: [0xc3]
4242
entry:
4343
%0 = tail call i32 @llvm.x86.sse2.cvtsd2si(<2 x double> %a)
4444
tail call void asm sideeffect "nop", "~{eax},~{ecx},~{edx},~{esi},~{edi},~{r8},~{r9},~{r10},~{r11}"()
@@ -48,31 +48,31 @@ entry:
4848
define <2 x i64> @map2_or_vex(ptr nocapture noundef readonly %b, i64 noundef %c) nounwind {
4949
; SSE-LABEL: map2_or_vex:
5050
; SSE: # %bb.0: # %entry
51-
; SSE-NEXT: pushq %r14
52-
; SSE-NEXT: pushq %rbx
53-
; SSE-NEXT: movq %rsi, %rbx
54-
; SSE-NEXT: movq %rdi, %r14
51+
; SSE-NEXT: pushq %r14 # encoding: [0x41,0x56]
52+
; SSE-NEXT: pushq %rbx # encoding: [0x53]
53+
; SSE-NEXT: movq %rsi, %rbx # encoding: [0x48,0x89,0xf3]
54+
; SSE-NEXT: movq %rdi, %r14 # encoding: [0x49,0x89,0xfe]
5555
; SSE-NEXT: #APP
56-
; SSE-NEXT: nop
56+
; SSE-NEXT: nop # encoding: [0x90]
5757
; SSE-NEXT: #NO_APP
58-
; SSE-NEXT: pabsb (%r14,%rbx,4), %xmm0
59-
; SSE-NEXT: popq %rbx
60-
; SSE-NEXT: popq %r14
61-
; SSE-NEXT: retq
58+
; SSE-NEXT: pabsb (%r14,%rbx,4), %xmm0 # encoding: [0x66,0x41,0x0f,0x38,0x1c,0x04,0x9e]
59+
; SSE-NEXT: popq %rbx # encoding: [0x5b]
60+
; SSE-NEXT: popq %r14 # encoding: [0x41,0x5e]
61+
; SSE-NEXT: retq # encoding: [0xc3]
6262
;
6363
; AVX-LABEL: map2_or_vex:
6464
; AVX: # %bb.0: # %entry
65-
; AVX-NEXT: pushq %r14
66-
; AVX-NEXT: pushq %rbx
67-
; AVX-NEXT: movq %rsi, %rbx
68-
; AVX-NEXT: movq %rdi, %r14
65+
; AVX-NEXT: pushq %r14 # encoding: [0x41,0x56]
66+
; AVX-NEXT: pushq %rbx # encoding: [0x53]
67+
; AVX-NEXT: movq %rsi, %rbx # encoding: [0x48,0x89,0xf3]
68+
; AVX-NEXT: movq %rdi, %r14 # encoding: [0x49,0x89,0xfe]
6969
; AVX-NEXT: #APP
70-
; AVX-NEXT: nop
70+
; AVX-NEXT: nop # encoding: [0x90]
7171
; AVX-NEXT: #NO_APP
72-
; AVX-NEXT: vpabsb (%r14,%rbx,4), %xmm0
73-
; AVX-NEXT: popq %rbx
74-
; AVX-NEXT: popq %r14
75-
; AVX-NEXT: retq
72+
; AVX-NEXT: vpabsb (%r14,%rbx,4), %xmm0 # encoding: [0xc4,0xc2,0x79,0x1c,0x04,0x9e]
73+
; AVX-NEXT: popq %rbx # encoding: [0x5b]
74+
; AVX-NEXT: popq %r14 # encoding: [0x41,0x5e]
75+
; AVX-NEXT: retq # encoding: [0xc3]
7676
entry:
7777
tail call void asm sideeffect "nop", "~{eax},~{ecx},~{edx},~{esi},~{edi},~{r8},~{r9},~{r10},~{r11}"()
7878
%add.ptr = getelementptr inbounds i32, ptr %b, i64 %c

llvm/test/CodeGen/X86/apx/no-rex2-pseudo-amx.ll

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
2-
; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+amx-tile,+egpr | FileCheck %s
2+
; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+amx-tile,+egpr --show-mc-encoding | FileCheck %s
33

44
define dso_local void @amx(ptr noundef %data) nounwind {
55
; CHECK-LABEL: amx:
66
; CHECK: # %bb.0: # %entry
7-
; CHECK-NEXT: pushq %rbx
8-
; CHECK-NEXT: movq %rdi, %rbx
7+
; CHECK-NEXT: pushq %rbx # encoding: [0x53]
8+
; CHECK-NEXT: movq %rdi, %rbx # encoding: [0x48,0x89,0xfb]
99
; CHECK-NEXT: #APP
10-
; CHECK-NEXT: nop
10+
; CHECK-NEXT: nop # encoding: [0x90]
1111
; CHECK-NEXT: #NO_APP
12-
; CHECK-NEXT: movl $8, %eax
13-
; CHECK-NEXT: tileloadd (%rbx,%rax), %tmm4
14-
; CHECK-NEXT: popq %rbx
15-
; CHECK-NEXT: retq
12+
; CHECK-NEXT: movl $8, %eax # encoding: [0xb8,0x08,0x00,0x00,0x00]
13+
; CHECK-NEXT: tileloadd (%rbx,%rax), %tmm4 # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x7b,0x4b,0x24,0x03]
14+
; CHECK-NEXT: popq %rbx # encoding: [0x5b]
15+
; CHECK-NEXT: retq # encoding: [0xc3]
1616
entry:
1717
tail call void asm sideeffect "nop", "~{eax},~{ecx},~{edx},~{esi},~{edi},~{r8},~{r9},~{r10},~{r11}"()
1818
call void @llvm.x86.tileloadd64(i8 4, ptr %data, i64 8)

llvm/test/CodeGen/X86/apx/no-rex2-pseudo-x87.ll

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
2-
; RUN: llc < %s -mtriple=x86_64-unknown -mattr=-sse,+egpr | FileCheck %s
2+
; RUN: llc < %s -mtriple=x86_64-unknown -mattr=-sse,+egpr --show-mc-encoding | FileCheck %s
33

44
define void @x87(ptr %0, ptr %1) nounwind {
55
; CHECK-LABEL: x87:
66
; CHECK: # %bb.0:
7-
; CHECK-NEXT: pushq %r14
8-
; CHECK-NEXT: pushq %rbx
9-
; CHECK-NEXT: movq %rsi, %rbx
10-
; CHECK-NEXT: movq %rdi, %r14
7+
; CHECK-NEXT: pushq %r14 # encoding: [0x41,0x56]
8+
; CHECK-NEXT: pushq %rbx # encoding: [0x53]
9+
; CHECK-NEXT: movq %rsi, %rbx # encoding: [0x48,0x89,0xf3]
10+
; CHECK-NEXT: movq %rdi, %r14 # encoding: [0x49,0x89,0xfe]
1111
; CHECK-NEXT: #APP
12-
; CHECK-NEXT: nop
12+
; CHECK-NEXT: nop # encoding: [0x90]
1313
; CHECK-NEXT: #NO_APP
14-
; CHECK-NEXT: flds (%r14)
15-
; CHECK-NEXT: fstps (%rbx)
16-
; CHECK-NEXT: popq %rbx
17-
; CHECK-NEXT: popq %r14
18-
; CHECK-NEXT: retq
14+
; CHECK-NEXT: flds (%r14) # encoding: [0x41,0xd9,0x06]
15+
; CHECK-NEXT: fstps (%rbx) # encoding: [0xd9,0x1b]
16+
; CHECK-NEXT: popq %rbx # encoding: [0x5b]
17+
; CHECK-NEXT: popq %r14 # encoding: [0x41,0x5e]
18+
; CHECK-NEXT: retq # encoding: [0xc3]
1919
tail call void asm sideeffect "nop", "~{eax},~{ecx},~{edx},~{esi},~{edi},~{r8},~{r9},~{r10},~{r11}"()
2020
%3 = load float, ptr %0
2121
store float %3, ptr %1

llvm/test/CodeGen/X86/apx/no-rex2-special.ll

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
2-
; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+xsave,+egpr | FileCheck %s
2+
; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+xsave,+egpr --show-mc-encoding | FileCheck %s
33

44
define void @test_xsave(ptr %ptr, i32 %hi, i32 %lo) nounwind {
55
; CHECK-LABEL: test_xsave:
66
; CHECK: # %bb.0:
7-
; CHECK-NEXT: pushq %rbx
8-
; CHECK-NEXT: movl %edx, %r16d
9-
; CHECK-NEXT: movl %esi, %edx
10-
; CHECK-NEXT: movq %rdi, %rbx
7+
; CHECK-NEXT: pushq %rbx # encoding: [0x53]
8+
; CHECK-NEXT: movl %edx, %r16d # encoding: [0xd5,0x10,0x89,0xd0]
9+
; CHECK-NEXT: movl %esi, %edx # encoding: [0x89,0xf2]
10+
; CHECK-NEXT: movq %rdi, %rbx # encoding: [0x48,0x89,0xfb]
1111
; CHECK-NEXT: #APP
12-
; CHECK-NEXT: nop
12+
; CHECK-NEXT: nop # encoding: [0x90]
1313
; CHECK-NEXT: #NO_APP
14-
; CHECK-NEXT: movl %r16d, %eax
15-
; CHECK-NEXT: xsave (%rbx)
16-
; CHECK-NEXT: popq %rbx
17-
; CHECK-NEXT: retq
14+
; CHECK-NEXT: movl %r16d, %eax # encoding: [0xd5,0x40,0x89,0xc0]
15+
; CHECK-NEXT: xsave (%rbx) # encoding: [0x0f,0xae,0x23]
16+
; CHECK-NEXT: popq %rbx # encoding: [0x5b]
17+
; CHECK-NEXT: retq # encoding: [0xc3]
1818
tail call void asm sideeffect "nop", "~{eax},~{ecx},~{esi},~{edi},~{r8},~{r9},~{r10},~{r11}"()
1919
call void @llvm.x86.xsave(ptr %ptr, i32 %hi, i32 %lo)
2020
ret void;
@@ -24,17 +24,17 @@ declare void @llvm.x86.xsave(ptr, i32, i32)
2424
define void @test_xsave64(ptr %ptr, i32 %hi, i32 %lo) nounwind {
2525
; CHECK-LABEL: test_xsave64:
2626
; CHECK: # %bb.0:
27-
; CHECK-NEXT: pushq %rbx
28-
; CHECK-NEXT: movl %edx, %r16d
29-
; CHECK-NEXT: movl %esi, %edx
30-
; CHECK-NEXT: movq %rdi, %rbx
27+
; CHECK-NEXT: pushq %rbx # encoding: [0x53]
28+
; CHECK-NEXT: movl %edx, %r16d # encoding: [0xd5,0x10,0x89,0xd0]
29+
; CHECK-NEXT: movl %esi, %edx # encoding: [0x89,0xf2]
30+
; CHECK-NEXT: movq %rdi, %rbx # encoding: [0x48,0x89,0xfb]
3131
; CHECK-NEXT: #APP
32-
; CHECK-NEXT: nop
32+
; CHECK-NEXT: nop # encoding: [0x90]
3333
; CHECK-NEXT: #NO_APP
34-
; CHECK-NEXT: movl %r16d, %eax
35-
; CHECK-NEXT: xsave64 (%rbx)
36-
; CHECK-NEXT: popq %rbx
37-
; CHECK-NEXT: retq
34+
; CHECK-NEXT: movl %r16d, %eax # encoding: [0xd5,0x40,0x89,0xc0]
35+
; CHECK-NEXT: xsave64 (%rbx) # encoding: [0x48,0x0f,0xae,0x23]
36+
; CHECK-NEXT: popq %rbx # encoding: [0x5b]
37+
; CHECK-NEXT: retq # encoding: [0xc3]
3838
tail call void asm sideeffect "nop", "~{eax},~{ecx},~{esi},~{edi},~{r8},~{r9},~{r10},~{r11}"()
3939
call void @llvm.x86.xsave64(ptr %ptr, i32 %hi, i32 %lo)
4040
ret void;
@@ -44,17 +44,17 @@ declare void @llvm.x86.xsave64(ptr, i32, i32)
4444
define void @test_xrstor(ptr %ptr, i32 %hi, i32 %lo) nounwind {
4545
; CHECK-LABEL: test_xrstor:
4646
; CHECK: # %bb.0:
47-
; CHECK-NEXT: pushq %rbx
48-
; CHECK-NEXT: movl %edx, %r16d
49-
; CHECK-NEXT: movl %esi, %edx
50-
; CHECK-NEXT: movq %rdi, %rbx
47+
; CHECK-NEXT: pushq %rbx # encoding: [0x53]
48+
; CHECK-NEXT: movl %edx, %r16d # encoding: [0xd5,0x10,0x89,0xd0]
49+
; CHECK-NEXT: movl %esi, %edx # encoding: [0x89,0xf2]
50+
; CHECK-NEXT: movq %rdi, %rbx # encoding: [0x48,0x89,0xfb]
5151
; CHECK-NEXT: #APP
52-
; CHECK-NEXT: nop
52+
; CHECK-NEXT: nop # encoding: [0x90]
5353
; CHECK-NEXT: #NO_APP
54-
; CHECK-NEXT: movl %r16d, %eax
55-
; CHECK-NEXT: xrstor (%rbx)
56-
; CHECK-NEXT: popq %rbx
57-
; CHECK-NEXT: retq
54+
; CHECK-NEXT: movl %r16d, %eax # encoding: [0xd5,0x40,0x89,0xc0]
55+
; CHECK-NEXT: xrstor (%rbx) # encoding: [0x0f,0xae,0x2b]
56+
; CHECK-NEXT: popq %rbx # encoding: [0x5b]
57+
; CHECK-NEXT: retq # encoding: [0xc3]
5858
tail call void asm sideeffect "nop", "~{eax},~{ecx},~{esi},~{edi},~{r8},~{r9},~{r10},~{r11}"()
5959
call void @llvm.x86.xrstor(ptr %ptr, i32 %hi, i32 %lo)
6060
ret void;
@@ -64,17 +64,17 @@ declare void @llvm.x86.xrstor(ptr, i32, i32)
6464
define void @test_xrstor64(ptr %ptr, i32 %hi, i32 %lo) nounwind {
6565
; CHECK-LABEL: test_xrstor64:
6666
; CHECK: # %bb.0:
67-
; CHECK-NEXT: pushq %rbx
68-
; CHECK-NEXT: movl %edx, %r16d
69-
; CHECK-NEXT: movl %esi, %edx
70-
; CHECK-NEXT: movq %rdi, %rbx
67+
; CHECK-NEXT: pushq %rbx # encoding: [0x53]
68+
; CHECK-NEXT: movl %edx, %r16d # encoding: [0xd5,0x10,0x89,0xd0]
69+
; CHECK-NEXT: movl %esi, %edx # encoding: [0x89,0xf2]
70+
; CHECK-NEXT: movq %rdi, %rbx # encoding: [0x48,0x89,0xfb]
7171
; CHECK-NEXT: #APP
72-
; CHECK-NEXT: nop
72+
; CHECK-NEXT: nop # encoding: [0x90]
7373
; CHECK-NEXT: #NO_APP
74-
; CHECK-NEXT: movl %r16d, %eax
75-
; CHECK-NEXT: xrstor64 (%rbx)
76-
; CHECK-NEXT: popq %rbx
77-
; CHECK-NEXT: retq
74+
; CHECK-NEXT: movl %r16d, %eax # encoding: [0xd5,0x40,0x89,0xc0]
75+
; CHECK-NEXT: xrstor64 (%rbx) # encoding: [0x48,0x0f,0xae,0x2b]
76+
; CHECK-NEXT: popq %rbx # encoding: [0x5b]
77+
; CHECK-NEXT: retq # encoding: [0xc3]
7878
tail call void asm sideeffect "nop", "~{eax},~{ecx},~{esi},~{edi},~{r8},~{r9},~{r10},~{r11}"()
7979
call void @llvm.x86.xrstor64(ptr %ptr, i32 %hi, i32 %lo)
8080
ret void;

0 commit comments

Comments
 (0)