1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown -mattr=+lwp | FileCheck %s --check-prefixes=X86,X86_LWP
3 ; RUN: llc < %s -mtriple=i686-unknown -mcpu=bdver1 | FileCheck %s --check-prefixes=X86,BDVER1,X86_BDVER1
4 ; RUN: llc < %s -mtriple=i686-unknown -mcpu=bdver2 | FileCheck %s --check-prefixes=X86,BDVER2,X86_BDVER2
5 ; RUN: llc < %s -mtriple=i686-unknown -mcpu=bdver3 | FileCheck %s --check-prefixes=X86,BDVER3,X86_BDVER3
6 ; RUN: llc < %s -mtriple=i686-unknown -mcpu=bdver4 | FileCheck %s --check-prefixes=X86,BDVER4,X86_BDVER4
7 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+lwp | FileCheck %s --check-prefixes=X64,X64_LWP
8 ; RUN: llc < %s -mtriple=x86_64-unknown -mcpu=bdver1 | FileCheck %s --check-prefixes=X64,BDVER1,X64_BDVER1
9 ; RUN: llc < %s -mtriple=x86_64-unknown -mcpu=bdver2 | FileCheck %s --check-prefixes=X64,BDVER2,X64_BDVER2
10 ; RUN: llc < %s -mtriple=x86_64-unknown -mcpu=bdver3 | FileCheck %s --check-prefixes=X64,BDVER3,X64_BDVER3
11 ; RUN: llc < %s -mtriple=x86_64-unknown -mcpu=bdver4 | FileCheck %s --check-prefixes=X64,BDVER4,X64_BDVER4
13 define void @test_llwpcb(i8 *%a0) nounwind {
14 ; X86-LABEL: test_llwpcb:
16 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
17 ; X86-NEXT: llwpcb %eax
20 ; X64-LABEL: test_llwpcb:
22 ; X64-NEXT: llwpcb %rdi
24 tail call void @llvm.x86.llwpcb(i8 *%a0)
28 define i8* @test_slwpcb(i8 *%a0) nounwind {
29 ; X86-LABEL: test_slwpcb:
31 ; X86-NEXT: slwpcb %eax
34 ; X64-LABEL: test_slwpcb:
36 ; X64-NEXT: slwpcb %rax
38 %1 = tail call i8* @llvm.x86.slwpcb()
42 define i8 @test_lwpins32_rri(i32 %a0, i32 %a1) nounwind {
43 ; X86_LWP-LABEL: test_lwpins32_rri:
45 ; X86_LWP-NEXT: movl {{[0-9]+}}(%esp), %eax
46 ; X86_LWP-NEXT: movl {{[0-9]+}}(%esp), %ecx
47 ; X86_LWP-NEXT: addl %ecx, %ecx
48 ; X86_LWP-NEXT: lwpins $-1985229329, %ecx, %eax # imm = 0x89ABCDEF
49 ; X86_LWP-NEXT: setb %al
52 ; X86_BDVER1-LABEL: test_lwpins32_rri:
53 ; X86_BDVER1: # %bb.0:
54 ; X86_BDVER1-NEXT: movl {{[0-9]+}}(%esp), %ecx
55 ; X86_BDVER1-NEXT: movl {{[0-9]+}}(%esp), %eax
56 ; X86_BDVER1-NEXT: addl %ecx, %ecx
57 ; X86_BDVER1-NEXT: lwpins $-1985229329, %ecx, %eax # imm = 0x89ABCDEF
58 ; X86_BDVER1-NEXT: setb %al
59 ; X86_BDVER1-NEXT: retl
61 ; X86_BDVER2-LABEL: test_lwpins32_rri:
62 ; X86_BDVER2: # %bb.0:
63 ; X86_BDVER2-NEXT: movl {{[0-9]+}}(%esp), %ecx
64 ; X86_BDVER2-NEXT: movl {{[0-9]+}}(%esp), %eax
65 ; X86_BDVER2-NEXT: addl %ecx, %ecx
66 ; X86_BDVER2-NEXT: lwpins $-1985229329, %ecx, %eax # imm = 0x89ABCDEF
67 ; X86_BDVER2-NEXT: setb %al
68 ; X86_BDVER2-NEXT: retl
70 ; X86_BDVER3-LABEL: test_lwpins32_rri:
71 ; X86_BDVER3: # %bb.0:
72 ; X86_BDVER3-NEXT: movl {{[0-9]+}}(%esp), %eax
73 ; X86_BDVER3-NEXT: movl {{[0-9]+}}(%esp), %ecx
74 ; X86_BDVER3-NEXT: addl %ecx, %ecx
75 ; X86_BDVER3-NEXT: lwpins $-1985229329, %ecx, %eax # imm = 0x89ABCDEF
76 ; X86_BDVER3-NEXT: setb %al
77 ; X86_BDVER3-NEXT: retl
79 ; X86_BDVER4-LABEL: test_lwpins32_rri:
80 ; X86_BDVER4: # %bb.0:
81 ; X86_BDVER4-NEXT: movl {{[0-9]+}}(%esp), %eax
82 ; X86_BDVER4-NEXT: movl {{[0-9]+}}(%esp), %ecx
83 ; X86_BDVER4-NEXT: addl %ecx, %ecx
84 ; X86_BDVER4-NEXT: lwpins $-1985229329, %ecx, %eax # imm = 0x89ABCDEF
85 ; X86_BDVER4-NEXT: setb %al
86 ; X86_BDVER4-NEXT: retl
88 ; X64-LABEL: test_lwpins32_rri:
90 ; X64-NEXT: addl %esi, %esi
91 ; X64-NEXT: lwpins $-1985229329, %esi, %edi # imm = 0x89ABCDEF
95 %2 = tail call i8 @llvm.x86.lwpins32(i32 %a0, i32 %1, i32 2309737967)
99 define i8 @test_lwpins32_rmi(i32 %a0, i32 *%p1) nounwind {
100 ; X86-LABEL: test_lwpins32_rmi:
102 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
103 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
104 ; X86-NEXT: lwpins $1985229328, (%eax), %ecx # imm = 0x76543210
108 ; X64-LABEL: test_lwpins32_rmi:
110 ; X64-NEXT: lwpins $1985229328, (%rsi), %edi # imm = 0x76543210
113 %a1 = load i32, i32 *%p1
114 %1 = tail call i8 @llvm.x86.lwpins32(i32 %a0, i32 %a1, i32 1985229328)
118 define void @test_lwpval32_rri(i32 %a0, i32 %a1) nounwind {
119 ; X86_LWP-LABEL: test_lwpval32_rri:
121 ; X86_LWP-NEXT: movl {{[0-9]+}}(%esp), %eax
122 ; X86_LWP-NEXT: movl {{[0-9]+}}(%esp), %ecx
123 ; X86_LWP-NEXT: addl %ecx, %ecx
124 ; X86_LWP-NEXT: lwpval $-19088744, %ecx, %eax # imm = 0xFEDCBA98
127 ; X86_BDVER1-LABEL: test_lwpval32_rri:
128 ; X86_BDVER1: # %bb.0:
129 ; X86_BDVER1-NEXT: movl {{[0-9]+}}(%esp), %ecx
130 ; X86_BDVER1-NEXT: movl {{[0-9]+}}(%esp), %eax
131 ; X86_BDVER1-NEXT: addl %ecx, %ecx
132 ; X86_BDVER1-NEXT: lwpval $-19088744, %ecx, %eax # imm = 0xFEDCBA98
133 ; X86_BDVER1-NEXT: retl
135 ; X86_BDVER2-LABEL: test_lwpval32_rri:
136 ; X86_BDVER2: # %bb.0:
137 ; X86_BDVER2-NEXT: movl {{[0-9]+}}(%esp), %ecx
138 ; X86_BDVER2-NEXT: movl {{[0-9]+}}(%esp), %eax
139 ; X86_BDVER2-NEXT: addl %ecx, %ecx
140 ; X86_BDVER2-NEXT: lwpval $-19088744, %ecx, %eax # imm = 0xFEDCBA98
141 ; X86_BDVER2-NEXT: retl
143 ; X86_BDVER3-LABEL: test_lwpval32_rri:
144 ; X86_BDVER3: # %bb.0:
145 ; X86_BDVER3-NEXT: movl {{[0-9]+}}(%esp), %eax
146 ; X86_BDVER3-NEXT: movl {{[0-9]+}}(%esp), %ecx
147 ; X86_BDVER3-NEXT: addl %ecx, %ecx
148 ; X86_BDVER3-NEXT: lwpval $-19088744, %ecx, %eax # imm = 0xFEDCBA98
149 ; X86_BDVER3-NEXT: retl
151 ; X86_BDVER4-LABEL: test_lwpval32_rri:
152 ; X86_BDVER4: # %bb.0:
153 ; X86_BDVER4-NEXT: movl {{[0-9]+}}(%esp), %eax
154 ; X86_BDVER4-NEXT: movl {{[0-9]+}}(%esp), %ecx
155 ; X86_BDVER4-NEXT: addl %ecx, %ecx
156 ; X86_BDVER4-NEXT: lwpval $-19088744, %ecx, %eax # imm = 0xFEDCBA98
157 ; X86_BDVER4-NEXT: retl
159 ; X64-LABEL: test_lwpval32_rri:
161 ; X64-NEXT: addl %esi, %esi
162 ; X64-NEXT: lwpval $-19088744, %esi, %edi # imm = 0xFEDCBA98
164 %1 = add i32 %a1, %a1
165 tail call void @llvm.x86.lwpval32(i32 %a0, i32 %1, i32 4275878552)
169 define void @test_lwpval32_rmi(i32 %a0, i32 *%p1) nounwind {
170 ; X86-LABEL: test_lwpval32_rmi:
172 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
173 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
174 ; X86-NEXT: lwpval $305419896, (%eax), %ecx # imm = 0x12345678
177 ; X64-LABEL: test_lwpval32_rmi:
179 ; X64-NEXT: lwpval $305419896, (%rsi), %edi # imm = 0x12345678
181 %a1 = load i32, i32 *%p1
182 tail call void @llvm.x86.lwpval32(i32 %a0, i32 %a1, i32 305419896)
186 declare void @llvm.x86.llwpcb(i8*) nounwind
187 declare i8* @llvm.x86.slwpcb() nounwind
188 declare i8 @llvm.x86.lwpins32(i32, i32, i32) nounwind
189 declare void @llvm.x86.lwpval32(i32, i32, i32) nounwind