xref: /llvm-project/llvm/test/Transforms/InstCombine/2007-03-25-BadShiftMask.ll (revision 462cb3cd6cecd0511ecaf0e3ebcaba455ece587d)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; PR1271
3; RUN: opt < %s -passes=instcombine -S | FileCheck %s
4
5%struct..0anon = type { i32, i32 }
6%struct..1anon = type { double }
7
8define i32 @main() {
9; CHECK-LABEL: @main(
10; CHECK-NEXT:  entry:
11; CHECK-NEXT:    [[U:%.*]] = alloca [[STRUCT__1ANON:%.*]], align 8
12; CHECK-NEXT:    store double 0x7FF0000000000000, ptr [[U]], align 8
13; CHECK-NEXT:    [[TMP5:%.*]] = getelementptr inbounds nuw i8, ptr [[U]], i64 4
14; CHECK-NEXT:    [[TMP6:%.*]] = load i32, ptr [[TMP5]], align 4
15; CHECK-NEXT:    [[TMP0:%.*]] = and i32 [[TMP6]], 2146435072
16; CHECK-NEXT:    [[DOTNOT:%.*]] = icmp eq i32 [[TMP0]], 2146435072
17; CHECK-NEXT:    br i1 [[DOTNOT]], label [[COND_FALSE:%.*]], label [[COND_TRUE:%.*]]
18; CHECK:       cond_true:
19; CHECK-NEXT:    ret i32 0
20; CHECK:       cond_false:
21; CHECK-NEXT:    ret i32 1
22;
23entry:
24  %u = alloca %struct..1anon, align 8
25  store double 0x7FF0000000000000, ptr %u
26  %tmp5 = getelementptr %struct..0anon, ptr %u, i32 0, i32 1
27  %tmp6 = load i32, ptr %tmp5
28  %tmp7 = shl i32 %tmp6, 1
29  %tmp8 = lshr i32 %tmp7, 21
30  %tmp89 = trunc i32 %tmp8 to i16
31  icmp ne i16 %tmp89, 2047
32  zext i1 %0 to i8
33  icmp ne i8 %1, 0
34  br i1 %2, label %cond_true, label %cond_false
35
36cond_true:
37  ret i32 0
38
39cond_false:
40  ret i32 1
41}
42
43