1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; PR1271
3; RUN: opt < %s -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:    [[TMP1:%.*]] = getelementptr inbounds %struct..1anon, %struct..1anon* [[U]], i64 0, i32 0
13; CHECK-NEXT:    store double 0x7FF0000000000000, double* [[TMP1]], align 8
14; CHECK-NEXT:    [[TMP34:%.*]] = bitcast %struct..1anon* [[U]] to %struct..0anon*
15; CHECK-NEXT:    [[TMP5:%.*]] = getelementptr inbounds %struct..0anon, %struct..0anon* [[TMP34]], i64 0, i32 1
16; CHECK-NEXT:    [[TMP6:%.*]] = load i32, i32* [[TMP5]], align 4
17; CHECK-NEXT:    [[TMP89:%.*]] = and i32 [[TMP6]], 2146435072
18; CHECK-NEXT:    [[TMP0:%.*]] = icmp eq i32 [[TMP89]], 2146435072
19; CHECK-NEXT:    br i1 [[TMP0]], label %cond_false, label %cond_true
20; CHECK:       cond_true:
21; CHECK-NEXT:    ret i32 0
22; CHECK:       cond_false:
23; CHECK-NEXT:    ret i32 1
24;
25entry:
26  %u = alloca %struct..1anon, align 8
27  %tmp1 = getelementptr %struct..1anon, %struct..1anon* %u, i32 0, i32 0
28  store double 0x7FF0000000000000, double* %tmp1
29  %tmp3 = getelementptr %struct..1anon, %struct..1anon* %u, i32 0, i32 0
30  %tmp34 = bitcast double* %tmp3 to %struct..0anon*
31  %tmp5 = getelementptr %struct..0anon, %struct..0anon* %tmp34, i32 0, i32 1
32  %tmp6 = load i32, i32* %tmp5
33  %tmp7 = shl i32 %tmp6, 1
34  %tmp8 = lshr i32 %tmp7, 21
35  %tmp89 = trunc i32 %tmp8 to i16
36  icmp ne i16 %tmp89, 2047
37  zext i1 %0 to i8
38  icmp ne i8 %1, 0
39  br i1 %2, label %cond_true, label %cond_false
40
41cond_true:
42  ret i32 0
43
44cond_false:
45  ret i32 1
46}
47
48