1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=instcombine %s | FileCheck %s
4 @a = common global i8 0, align 1
5 @b = external global i32
7 define void @tinkywinky() {
8 ; CHECK-LABEL: @tinkywinky(
9 ; CHECK-NEXT: [[PATATINO:%.*]] = load i8, ptr @a, align 1
10 ; CHECK-NEXT: [[TOBOOL_NOT:%.*]] = icmp eq i8 [[PATATINO]], 0
11 ; CHECK-NEXT: [[CMP:%.*]] = icmp ne ptr @a, @b
12 ; CHECK-NEXT: [[XOR1:%.*]] = or i1 [[CMP]], [[TOBOOL_NOT]]
13 ; CHECK-NEXT: [[XOR:%.*]] = zext i1 [[XOR1]] to i32
14 ; CHECK-NEXT: [[OR:%.*]] = or disjoint i32 [[XOR]], 2
15 ; CHECK-NEXT: store i32 [[OR]], ptr @b, align 4
16 ; CHECK-NEXT: ret void
18 %patatino = load i8, ptr @a
19 %tobool = icmp ne i8 %patatino, 0
20 %lnot = xor i1 %tobool, true
21 %lnot.ext = zext i1 %lnot to i32
22 %cmp = icmp ne ptr @a, @b
23 %zext = zext i1 %cmp to i32
24 %xor = xor i32 %zext, 2
25 %or = or i32 %xor, %lnot.ext
26 store i32 %or, ptr @b, align 4