Skip to content

Commit 89f2fee

Browse files
committed
[InstCombine] Add test for incorrect retention of Range attribute in fshl
1 parent e5b0132 commit 89f2fee

File tree

1 file changed

+15
-0
lines changed
  • llvm/test/Transforms/InstCombine

1 file changed

+15
-0
lines changed

llvm/test/Transforms/InstCombine/fsh.ll

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,3 +1068,18 @@ entry:
10681068
%res = call <2 x i31> @llvm.fshl.v2i31(<2 x i31> %x, <2 x i31> zeroinitializer, <2 x i31> %y)
10691069
ret <2 x i31> %res
10701070
}
1071+
1072+
define i8 @fshl_range_trunc(i1 %x) {
1073+
; CHECK-LABEL: @fshl_range_trunc(
1074+
; CHECK-NEXT: [[ZEXT:%.*]] = zext i1 [[X:%.*]] to i32
1075+
; CHECK-NEXT: [[OR:%.*]] = or disjoint i32 [[ZEXT]], 126
1076+
; CHECK-NEXT: [[FSHL:%.*]] = call range(i32 -4, 2) i32 @llvm.fshl.i32(i32 [[OR]], i32 -2, i32 1)
1077+
; CHECK-NEXT: [[TR:%.*]] = trunc nuw i32 [[FSHL]] to i8
1078+
; CHECK-NEXT: ret i8 [[TR]]
1079+
;
1080+
%zext = zext i1 %x to i32
1081+
%or = or disjoint i32 %zext, -2
1082+
%fshl = call range(i32 -4, 2) i32 @llvm.fshl.i32(i32 %or, i32 %or, i32 1)
1083+
%tr = trunc nsw i32 %fshl to i8
1084+
ret i8 %tr
1085+
}

0 commit comments

Comments
 (0)