Skip to content

Commit 0556b5c

Browse files
committed
[InstCombine] Add a negative vector test. NFC.
1 parent 9f02fb4 commit 0556b5c

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

llvm/test/Transforms/InstCombine/fpclass-from-dom-cond.ll

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,41 @@ if.end:
7777
%ret = call float @llvm.fabs.f32(float %value)
7878
ret float %ret
7979
}
80+
81+
define <2 x float> @test_signbit_check_wrong_type(<2 x float> %x, i1 %cond) {
82+
; CHECK-LABEL: define <2 x float> @test_signbit_check_wrong_type(
83+
; CHECK-SAME: <2 x float> [[X:%.*]], i1 [[COND:%.*]]) {
84+
; CHECK-NEXT: [[I32:%.*]] = bitcast <2 x float> [[X]] to i64
85+
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i64 [[I32]], 0
86+
; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN1:%.*]], label [[IF_ELSE:%.*]]
87+
; CHECK: if.then1:
88+
; CHECK-NEXT: [[FNEG:%.*]] = fneg <2 x float> [[X]]
89+
; CHECK-NEXT: br label [[IF_END:%.*]]
90+
; CHECK: if.else:
91+
; CHECK-NEXT: br i1 [[COND]], label [[IF_THEN2:%.*]], label [[IF_END]]
92+
; CHECK: if.then2:
93+
; CHECK-NEXT: br label [[IF_END]]
94+
; CHECK: if.end:
95+
; CHECK-NEXT: [[VALUE:%.*]] = phi <2 x float> [ [[FNEG]], [[IF_THEN1]] ], [ [[X]], [[IF_THEN2]] ], [ [[X]], [[IF_ELSE]] ]
96+
; CHECK-NEXT: [[RET:%.*]] = call <2 x float> @llvm.fabs.v2f32(<2 x float> [[VALUE]])
97+
; CHECK-NEXT: ret <2 x float> [[RET]]
98+
;
99+
%i32 = bitcast <2 x float> %x to i64
100+
%cmp = icmp slt i64 %i32, 0
101+
br i1 %cmp, label %if.then1, label %if.else
102+
103+
if.then1:
104+
%fneg = fneg <2 x float> %x
105+
br label %if.end
106+
107+
if.else:
108+
br i1 %cond, label %if.then2, label %if.end
109+
110+
if.then2:
111+
br label %if.end
112+
113+
if.end:
114+
%value = phi <2 x float> [ %fneg, %if.then1 ], [ %x, %if.then2 ], [ %x, %if.else ]
115+
%ret = call <2 x float> @llvm.fabs.v2f32(<2 x float> %value)
116+
ret <2 x float> %ret
117+
}

0 commit comments

Comments
 (0)