Skip to content

Commit 93fa070

Browse files
committed
[InstCombine] Add pre-commit tests. NFC.
1 parent d80bdf7 commit 93fa070

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

llvm/test/Transforms/InstCombine/intrinsic-select.ll

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
; RUN: opt -passes=instcombine -S < %s | FileCheck %s
33

44
declare void @use(i32)
5+
declare void @usef32(float)
56

67
declare i32 @llvm.ctlz.i32(i32, i1)
78
declare <3 x i17> @llvm.ctlz.v3i17(<3 x i17>, i1)
@@ -344,3 +345,17 @@ define double @test_fabs_select_fmf2(i1 %cond, double %a) {
344345
%fabs = call nnan ninf nsz double @llvm.fabs.f64(double %sel1)
345346
ret double %fabs
346347
}
348+
349+
define float @test_fabs_select_multiuse(i1 %cond, float %x) {
350+
; CHECK-LABEL: @test_fabs_select_multiuse(
351+
; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND:%.*]], float [[X:%.*]], float 0x7FF0000000000000
352+
; CHECK-NEXT: call void @usef32(float [[SELECT]])
353+
; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X]])
354+
; CHECK-NEXT: [[FABS:%.*]] = select i1 [[COND]], float [[TMP1]], float 0x7FF0000000000000
355+
; CHECK-NEXT: ret float [[FABS]]
356+
;
357+
%select = select i1 %cond, float %x, float 0x7FF0000000000000
358+
call void @usef32(float %select)
359+
%fabs = call float @llvm.fabs.f32(float %select)
360+
ret float %fabs
361+
}

0 commit comments

Comments
 (0)