1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -codegenprepare < %s | FileCheck %s
4 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-unknown-linux-gnu"
7 define i1 @PR41004(i32 %x, i32 %y, i32 %t1) {
8 ; CHECK-LABEL: @PR41004(
10 ; CHECK-NEXT: [[T0:%.*]] = icmp eq i32 [[Y:%.*]], 1
11 ; CHECK-NEXT: br i1 [[T0]], label [[SELECT_TRUE_SINK:%.*]], label [[SELECT_END:%.*]]
12 ; CHECK: select.true.sink:
13 ; CHECK-NEXT: [[REM:%.*]] = srem i32 [[X:%.*]], 2
14 ; CHECK-NEXT: br label [[SELECT_END]]
16 ; CHECK-NEXT: [[MUL:%.*]] = phi i32 [ [[REM]], [[SELECT_TRUE_SINK]] ], [ 0, [[ENTRY:%.*]] ]
17 ; CHECK-NEXT: [[NEG:%.*]] = add i32 [[T1:%.*]], -1
18 ; CHECK-NEXT: [[ADD:%.*]] = add i32 [[NEG]], [[MUL]]
19 ; CHECK-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[T1]], 0
20 ; CHECK-NEXT: ret i1 [[TOBOOL]]
24 %t0 = icmp eq i32 %y, 1
25 %mul = select i1 %t0, i32 %rem, i32 0
26 %neg = add i32 %t1, -1
27 %add = add i32 %neg, %mul
31 %tobool = icmp eq i32 %t1, 0