xref: /llvm-project/llvm/test/CodeGen/X86/signbit-test.ll (revision adc7c589c3dd35af5991ee481fa4667094bca548)
1772c2f46SSanjay Patel; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2772c2f46SSanjay Patel; RUN: llc < %s -mtriple=x86_64-- | FileCheck %s
3772c2f46SSanjay Patel
4772c2f46SSanjay Pateldefine i64 @test_clear_mask_i64_i32(i64 %x) nounwind {
5772c2f46SSanjay Patel; CHECK-LABEL: test_clear_mask_i64_i32:
6772c2f46SSanjay Patel; CHECK:       # %bb.0: # %entry
7772c2f46SSanjay Patel; CHECK-NEXT:    movq %rdi, %rax
8*adc7c589SSanjay Patel; CHECK-NEXT:    testl %eax, %eax
9*adc7c589SSanjay Patel; CHECK-NEXT:    js .LBB0_2
10772c2f46SSanjay Patel; CHECK-NEXT:  # %bb.1: # %t
11772c2f46SSanjay Patel; CHECK-NEXT:    movl $42, %eax
12772c2f46SSanjay Patel; CHECK-NEXT:  .LBB0_2: # %f
13772c2f46SSanjay Patel; CHECK-NEXT:    retq
14772c2f46SSanjay Patelentry:
15772c2f46SSanjay Patel  %a = and i64 %x, 2147483648
16772c2f46SSanjay Patel  %r = icmp eq i64 %a, 0
17772c2f46SSanjay Patel  br i1 %r, label %t, label %f
18772c2f46SSanjay Patelt:
19772c2f46SSanjay Patel  br label %f
20772c2f46SSanjay Patelf:
21772c2f46SSanjay Patel  %ret = phi i64 [ %x, %entry], [ 42, %t]
22772c2f46SSanjay Patel  ret i64 %ret
23772c2f46SSanjay Patel}
24772c2f46SSanjay Patel
25772c2f46SSanjay Pateldefine i64 @test_set_mask_i64_i32(i64 %x) nounwind {
26772c2f46SSanjay Patel; CHECK-LABEL: test_set_mask_i64_i32:
27772c2f46SSanjay Patel; CHECK:       # %bb.0: # %entry
28772c2f46SSanjay Patel; CHECK-NEXT:    movq %rdi, %rax
29*adc7c589SSanjay Patel; CHECK-NEXT:    testl %eax, %eax
30*adc7c589SSanjay Patel; CHECK-NEXT:    jns .LBB1_2
31772c2f46SSanjay Patel; CHECK-NEXT:  # %bb.1: # %t
32772c2f46SSanjay Patel; CHECK-NEXT:    movl $42, %eax
33772c2f46SSanjay Patel; CHECK-NEXT:  .LBB1_2: # %f
34772c2f46SSanjay Patel; CHECK-NEXT:    retq
35772c2f46SSanjay Patelentry:
36772c2f46SSanjay Patel  %a = and i64 %x, 2147483648
37772c2f46SSanjay Patel  %r = icmp ne i64 %a, 0
38772c2f46SSanjay Patel  br i1 %r, label %t, label %f
39772c2f46SSanjay Patelt:
40772c2f46SSanjay Patel  br label %f
41772c2f46SSanjay Patelf:
42772c2f46SSanjay Patel  %ret = phi i64 [ %x, %entry], [ 42, %t]
43772c2f46SSanjay Patel  ret i64 %ret
44772c2f46SSanjay Patel}
45772c2f46SSanjay Patel
46772c2f46SSanjay Pateldefine i64 @test_clear_mask_i64_i16(i64 %x) nounwind {
47772c2f46SSanjay Patel; CHECK-LABEL: test_clear_mask_i64_i16:
48772c2f46SSanjay Patel; CHECK:       # %bb.0: # %entry
49772c2f46SSanjay Patel; CHECK-NEXT:    movq %rdi, %rax
50*adc7c589SSanjay Patel; CHECK-NEXT:    testw %ax, %ax
51*adc7c589SSanjay Patel; CHECK-NEXT:    js .LBB2_2
52772c2f46SSanjay Patel; CHECK-NEXT:  # %bb.1: # %t
53772c2f46SSanjay Patel; CHECK-NEXT:    movl $42, %eax
54772c2f46SSanjay Patel; CHECK-NEXT:  .LBB2_2: # %f
55772c2f46SSanjay Patel; CHECK-NEXT:    retq
56772c2f46SSanjay Patelentry:
57772c2f46SSanjay Patel  %a = and i64 %x, 32768
58772c2f46SSanjay Patel  %r = icmp eq i64 %a, 0
59772c2f46SSanjay Patel  br i1 %r, label %t, label %f
60772c2f46SSanjay Patelt:
61772c2f46SSanjay Patel  br label %f
62772c2f46SSanjay Patelf:
63772c2f46SSanjay Patel  %ret = phi i64 [ %x, %entry], [ 42, %t]
64772c2f46SSanjay Patel  ret i64 %ret
65772c2f46SSanjay Patel}
66772c2f46SSanjay Patel
67772c2f46SSanjay Pateldefine i64 @test_set_mask_i64_i16(i64 %x) nounwind {
68772c2f46SSanjay Patel; CHECK-LABEL: test_set_mask_i64_i16:
69772c2f46SSanjay Patel; CHECK:       # %bb.0: # %entry
70772c2f46SSanjay Patel; CHECK-NEXT:    movq %rdi, %rax
71*adc7c589SSanjay Patel; CHECK-NEXT:    testw %ax, %ax
72*adc7c589SSanjay Patel; CHECK-NEXT:    jns .LBB3_2
73772c2f46SSanjay Patel; CHECK-NEXT:  # %bb.1: # %t
74772c2f46SSanjay Patel; CHECK-NEXT:    movl $42, %eax
75772c2f46SSanjay Patel; CHECK-NEXT:  .LBB3_2: # %f
76772c2f46SSanjay Patel; CHECK-NEXT:    retq
77772c2f46SSanjay Patelentry:
78772c2f46SSanjay Patel  %a = and i64 %x, 32768
79772c2f46SSanjay Patel  %r = icmp ne i64 %a, 0
80772c2f46SSanjay Patel  br i1 %r, label %t, label %f
81772c2f46SSanjay Patelt:
82772c2f46SSanjay Patel  br label %f
83772c2f46SSanjay Patelf:
84772c2f46SSanjay Patel  %ret = phi i64 [ %x, %entry], [ 42, %t]
85772c2f46SSanjay Patel  ret i64 %ret
86772c2f46SSanjay Patel}
87772c2f46SSanjay Patel
88772c2f46SSanjay Pateldefine i64 @test_clear_mask_i64_i8(i64 %x) nounwind {
89772c2f46SSanjay Patel; CHECK-LABEL: test_clear_mask_i64_i8:
90772c2f46SSanjay Patel; CHECK:       # %bb.0: # %entry
91772c2f46SSanjay Patel; CHECK-NEXT:    movq %rdi, %rax
92*adc7c589SSanjay Patel; CHECK-NEXT:    testb %al, %al
93*adc7c589SSanjay Patel; CHECK-NEXT:    js .LBB4_2
94772c2f46SSanjay Patel; CHECK-NEXT:  # %bb.1: # %t
95772c2f46SSanjay Patel; CHECK-NEXT:    movl $42, %eax
96772c2f46SSanjay Patel; CHECK-NEXT:  .LBB4_2: # %f
97772c2f46SSanjay Patel; CHECK-NEXT:    retq
98772c2f46SSanjay Patelentry:
99772c2f46SSanjay Patel  %a = and i64 %x, 128
100772c2f46SSanjay Patel  %r = icmp eq i64 %a, 0
101772c2f46SSanjay Patel  br i1 %r, label %t, label %f
102772c2f46SSanjay Patelt:
103772c2f46SSanjay Patel  br label %f
104772c2f46SSanjay Patelf:
105772c2f46SSanjay Patel  %ret = phi i64 [ %x, %entry], [ 42, %t]
106772c2f46SSanjay Patel  ret i64 %ret
107772c2f46SSanjay Patel}
108772c2f46SSanjay Patel
109772c2f46SSanjay Pateldefine i64 @test_set_mask_i64_i8(i64 %x) nounwind {
110772c2f46SSanjay Patel; CHECK-LABEL: test_set_mask_i64_i8:
111772c2f46SSanjay Patel; CHECK:       # %bb.0: # %entry
112772c2f46SSanjay Patel; CHECK-NEXT:    movq %rdi, %rax
113*adc7c589SSanjay Patel; CHECK-NEXT:    testb %al, %al
114*adc7c589SSanjay Patel; CHECK-NEXT:    jns .LBB5_2
115772c2f46SSanjay Patel; CHECK-NEXT:  # %bb.1: # %t
116772c2f46SSanjay Patel; CHECK-NEXT:    movl $42, %eax
117772c2f46SSanjay Patel; CHECK-NEXT:  .LBB5_2: # %f
118772c2f46SSanjay Patel; CHECK-NEXT:    retq
119772c2f46SSanjay Patelentry:
120772c2f46SSanjay Patel  %a = and i64 %x, 128
121772c2f46SSanjay Patel  %r = icmp ne i64 %a, 0
122772c2f46SSanjay Patel  br i1 %r, label %t, label %f
123772c2f46SSanjay Patelt:
124772c2f46SSanjay Patel  br label %f
125772c2f46SSanjay Patelf:
126772c2f46SSanjay Patel  %ret = phi i64 [ %x, %entry], [ 42, %t]
127772c2f46SSanjay Patel  ret i64 %ret
128772c2f46SSanjay Patel}
129772c2f46SSanjay Patel
130772c2f46SSanjay Pateldefine i32 @test_clear_mask_i32_i16(i32 %x) nounwind {
131772c2f46SSanjay Patel; CHECK-LABEL: test_clear_mask_i32_i16:
132772c2f46SSanjay Patel; CHECK:       # %bb.0: # %entry
133772c2f46SSanjay Patel; CHECK-NEXT:    movl %edi, %eax
134*adc7c589SSanjay Patel; CHECK-NEXT:    testw %ax, %ax
135*adc7c589SSanjay Patel; CHECK-NEXT:    js .LBB6_2
136772c2f46SSanjay Patel; CHECK-NEXT:  # %bb.1: # %t
137772c2f46SSanjay Patel; CHECK-NEXT:    movl $42, %eax
138772c2f46SSanjay Patel; CHECK-NEXT:  .LBB6_2: # %f
139772c2f46SSanjay Patel; CHECK-NEXT:    retq
140772c2f46SSanjay Patelentry:
141772c2f46SSanjay Patel  %a = and i32 %x, 32768
142772c2f46SSanjay Patel  %r = icmp eq i32 %a, 0
143772c2f46SSanjay Patel  br i1 %r, label %t, label %f
144772c2f46SSanjay Patelt:
145772c2f46SSanjay Patel  br label %f
146772c2f46SSanjay Patelf:
147772c2f46SSanjay Patel  %ret = phi i32 [ %x, %entry], [ 42, %t]
148772c2f46SSanjay Patel  ret i32 %ret
149772c2f46SSanjay Patel}
150772c2f46SSanjay Patel
151772c2f46SSanjay Pateldefine i32 @test_set_mask_i32_i16(i32 %x) nounwind {
152772c2f46SSanjay Patel; CHECK-LABEL: test_set_mask_i32_i16:
153772c2f46SSanjay Patel; CHECK:       # %bb.0: # %entry
154772c2f46SSanjay Patel; CHECK-NEXT:    movl %edi, %eax
155*adc7c589SSanjay Patel; CHECK-NEXT:    testw %ax, %ax
156*adc7c589SSanjay Patel; CHECK-NEXT:    jns .LBB7_2
157772c2f46SSanjay Patel; CHECK-NEXT:  # %bb.1: # %t
158772c2f46SSanjay Patel; CHECK-NEXT:    movl $42, %eax
159772c2f46SSanjay Patel; CHECK-NEXT:  .LBB7_2: # %f
160772c2f46SSanjay Patel; CHECK-NEXT:    retq
161772c2f46SSanjay Patelentry:
162772c2f46SSanjay Patel  %a = and i32 %x, 32768
163772c2f46SSanjay Patel  %r = icmp ne i32 %a, 0
164772c2f46SSanjay Patel  br i1 %r, label %t, label %f
165772c2f46SSanjay Patelt:
166772c2f46SSanjay Patel  br label %f
167772c2f46SSanjay Patelf:
168772c2f46SSanjay Patel  %ret = phi i32 [ %x, %entry], [ 42, %t]
169772c2f46SSanjay Patel  ret i32 %ret
170772c2f46SSanjay Patel}
171772c2f46SSanjay Patel
172772c2f46SSanjay Pateldefine i32 @test_clear_mask_i32_i8(i32 %x) nounwind {
173772c2f46SSanjay Patel; CHECK-LABEL: test_clear_mask_i32_i8:
174772c2f46SSanjay Patel; CHECK:       # %bb.0: # %entry
175772c2f46SSanjay Patel; CHECK-NEXT:    movl %edi, %eax
176*adc7c589SSanjay Patel; CHECK-NEXT:    testb %al, %al
177*adc7c589SSanjay Patel; CHECK-NEXT:    js .LBB8_2
178772c2f46SSanjay Patel; CHECK-NEXT:  # %bb.1: # %t
179772c2f46SSanjay Patel; CHECK-NEXT:    movl $42, %eax
180772c2f46SSanjay Patel; CHECK-NEXT:  .LBB8_2: # %f
181772c2f46SSanjay Patel; CHECK-NEXT:    retq
182772c2f46SSanjay Patelentry:
183772c2f46SSanjay Patel  %a = and i32 %x, 128
184772c2f46SSanjay Patel  %r = icmp eq i32 %a, 0
185772c2f46SSanjay Patel  br i1 %r, label %t, label %f
186772c2f46SSanjay Patelt:
187772c2f46SSanjay Patel  br label %f
188772c2f46SSanjay Patelf:
189772c2f46SSanjay Patel  %ret = phi i32 [ %x, %entry], [ 42, %t]
190772c2f46SSanjay Patel  ret i32 %ret
191772c2f46SSanjay Patel}
192772c2f46SSanjay Patel
193772c2f46SSanjay Pateldefine i32 @test_set_mask_i32_i8(i32 %x) nounwind {
194772c2f46SSanjay Patel; CHECK-LABEL: test_set_mask_i32_i8:
195772c2f46SSanjay Patel; CHECK:       # %bb.0: # %entry
196772c2f46SSanjay Patel; CHECK-NEXT:    movl %edi, %eax
197*adc7c589SSanjay Patel; CHECK-NEXT:    testb %al, %al
198*adc7c589SSanjay Patel; CHECK-NEXT:    jns .LBB9_2
199772c2f46SSanjay Patel; CHECK-NEXT:  # %bb.1: # %t
200772c2f46SSanjay Patel; CHECK-NEXT:    movl $42, %eax
201772c2f46SSanjay Patel; CHECK-NEXT:  .LBB9_2: # %f
202772c2f46SSanjay Patel; CHECK-NEXT:    retq
203772c2f46SSanjay Patelentry:
204772c2f46SSanjay Patel  %a = and i32 %x, 128
205772c2f46SSanjay Patel  %r = icmp ne i32 %a, 0
206772c2f46SSanjay Patel  br i1 %r, label %t, label %f
207772c2f46SSanjay Patelt:
208772c2f46SSanjay Patel  br label %f
209772c2f46SSanjay Patelf:
210772c2f46SSanjay Patel  %ret = phi i32 [ %x, %entry], [ 42, %t]
211772c2f46SSanjay Patel  ret i32 %ret
212772c2f46SSanjay Patel}
213772c2f46SSanjay Patel
214772c2f46SSanjay Pateldefine i16 @test_clear_mask_i16_i8(i16 %x) nounwind {
215772c2f46SSanjay Patel; CHECK-LABEL: test_clear_mask_i16_i8:
216772c2f46SSanjay Patel; CHECK:       # %bb.0: # %entry
217772c2f46SSanjay Patel; CHECK-NEXT:    movl %edi, %eax
218*adc7c589SSanjay Patel; CHECK-NEXT:    testb %al, %al
219*adc7c589SSanjay Patel; CHECK-NEXT:    js .LBB10_2
220772c2f46SSanjay Patel; CHECK-NEXT:  # %bb.1: # %t
221772c2f46SSanjay Patel; CHECK-NEXT:    movw $42, %ax
222772c2f46SSanjay Patel; CHECK-NEXT:  .LBB10_2: # %f
223772c2f46SSanjay Patel; CHECK-NEXT:    # kill: def $ax killed $ax killed $eax
224772c2f46SSanjay Patel; CHECK-NEXT:    retq
225772c2f46SSanjay Patelentry:
226772c2f46SSanjay Patel  %a = and i16 %x, 128
227772c2f46SSanjay Patel  %r = icmp eq i16 %a, 0
228772c2f46SSanjay Patel  br i1 %r, label %t, label %f
229772c2f46SSanjay Patelt:
230772c2f46SSanjay Patel  br label %f
231772c2f46SSanjay Patelf:
232772c2f46SSanjay Patel  %ret = phi i16 [ %x, %entry], [ 42, %t]
233772c2f46SSanjay Patel  ret i16 %ret
234772c2f46SSanjay Patel}
235772c2f46SSanjay Patel
236772c2f46SSanjay Pateldefine i16 @test_set_mask_i16_i8(i16 %x) nounwind {
237772c2f46SSanjay Patel; CHECK-LABEL: test_set_mask_i16_i8:
238772c2f46SSanjay Patel; CHECK:       # %bb.0: # %entry
239772c2f46SSanjay Patel; CHECK-NEXT:    movl %edi, %eax
240*adc7c589SSanjay Patel; CHECK-NEXT:    testb %al, %al
241*adc7c589SSanjay Patel; CHECK-NEXT:    jns .LBB11_2
242772c2f46SSanjay Patel; CHECK-NEXT:  # %bb.1: # %t
243772c2f46SSanjay Patel; CHECK-NEXT:    movw $42, %ax
244772c2f46SSanjay Patel; CHECK-NEXT:  .LBB11_2: # %f
245772c2f46SSanjay Patel; CHECK-NEXT:    # kill: def $ax killed $ax killed $eax
246772c2f46SSanjay Patel; CHECK-NEXT:    retq
247772c2f46SSanjay Patelentry:
248772c2f46SSanjay Patel  %a = and i16 %x, 128
249772c2f46SSanjay Patel  %r = icmp ne i16 %a, 0
250772c2f46SSanjay Patel  br i1 %r, label %t, label %f
251772c2f46SSanjay Patelt:
252772c2f46SSanjay Patel  br label %f
253772c2f46SSanjay Patelf:
254772c2f46SSanjay Patel  %ret = phi i16 [ %x, %entry], [ 42, %t]
255772c2f46SSanjay Patel  ret i16 %ret
256772c2f46SSanjay Patel}
257772c2f46SSanjay Patel
258772c2f46SSanjay Pateldefine i16 @test_set_mask_i16_i7(i16 %x) nounwind {
259772c2f46SSanjay Patel; CHECK-LABEL: test_set_mask_i16_i7:
260772c2f46SSanjay Patel; CHECK:       # %bb.0: # %entry
261772c2f46SSanjay Patel; CHECK-NEXT:    movl %edi, %eax
262772c2f46SSanjay Patel; CHECK-NEXT:    testb $64, %al
263772c2f46SSanjay Patel; CHECK-NEXT:    je .LBB12_2
264772c2f46SSanjay Patel; CHECK-NEXT:  # %bb.1: # %t
265772c2f46SSanjay Patel; CHECK-NEXT:    movw $42, %ax
266772c2f46SSanjay Patel; CHECK-NEXT:  .LBB12_2: # %f
267772c2f46SSanjay Patel; CHECK-NEXT:    # kill: def $ax killed $ax killed $eax
268772c2f46SSanjay Patel; CHECK-NEXT:    retq
269772c2f46SSanjay Patelentry:
270772c2f46SSanjay Patel  %a = and i16 %x, 64
271772c2f46SSanjay Patel  %r = icmp ne i16 %a, 0
272772c2f46SSanjay Patel  br i1 %r, label %t, label %f
273772c2f46SSanjay Patelt:
274772c2f46SSanjay Patel  br label %f
275772c2f46SSanjay Patelf:
276772c2f46SSanjay Patel  %ret = phi i16 [ %x, %entry], [ 42, %t]
277772c2f46SSanjay Patel  ret i16 %ret
278772c2f46SSanjay Patel}
279