1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instcombine -S | FileCheck %s
4 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
6 define i1 @test1(i32 %X) {
8 ; CHECK-NEXT: [[C:%.*]] = icmp ne i32 [[X:%.*]], 12
9 ; CHECK-NEXT: ret i1 [[C]]
11 %A = bitcast i32 %X to i32
12 ; Convert to setne int %X, 12
13 %c = icmp ne i32 %A, 12
17 define i1 @test2(i32 %X, i32 %Y) {
18 ; CHECK-LABEL: @test2(
19 ; CHECK-NEXT: [[C:%.*]] = icmp ne i32 [[X:%.*]], [[Y:%.*]]
20 ; CHECK-NEXT: ret i1 [[C]]
22 %A = bitcast i32 %X to i32
23 %B = bitcast i32 %Y to i32
24 ; Convert to setne int %X, %Y
25 %c = icmp ne i32 %A, %B
29 define i32 @test4(i32 %A) {
30 ; CHECK-LABEL: @test4(
31 ; CHECK-NEXT: [[C:%.*]] = shl i32 [[A:%.*]], 2
32 ; CHECK-NEXT: ret i32 [[C]]
34 %B = bitcast i32 %A to i32
36 %D = bitcast i32 %C to i32
40 define i16 @test5(i16 %A) {
41 ; CHECK-LABEL: @test5(
42 ; CHECK-NEXT: [[TMP1:%.*]] = and i16 [[A:%.*]], 15
43 ; CHECK-NEXT: ret i16 [[TMP1]]
45 %B = sext i16 %A to i32
47 %D = trunc i32 %C to i16
51 define i1 @test6(i1 %A) {
52 ; CHECK-LABEL: @test6(
53 ; CHECK-NEXT: ret i1 [[A:%.*]]
55 %B = zext i1 %A to i32
56 %C = icmp ne i32 %B, 0
60 define i1 @test6a(i1 %A) {
61 ; CHECK-LABEL: @test6a(
62 ; CHECK-NEXT: ret i1 true
64 %B = zext i1 %A to i32
65 %C = icmp ne i32 %B, -1
69 define i1 @test7(ptr %A) {
70 ; CHECK-LABEL: @test7(
71 ; CHECK-NEXT: [[C:%.*]] = icmp eq ptr [[A:%.*]], null
72 ; CHECK-NEXT: ret i1 [[C]]
74 %C = icmp eq ptr %A, null