1 ; NOTE: Assertions have been autogenerated by update_test_checks.py
2 ; RUN: opt -S -instsimplify < %s | FileCheck %s
4 target datalayout = "E-m:e-i64:64-n32:64"
5 target triple = "powerpc64-unknown-linux-gnu"
7 define zeroext i1 @_Z10isNegativemj(i64 %Val, i32 zeroext %IntegerBitWidth) {
8 ; CHECK-LABEL: @_Z10isNegativemj(
9 ; CHECK: [[CONV:%.*]] = zext i32 %IntegerBitWidth to i64
10 ; CHECK-NEXT: [[SUB:%.*]] = sub i64 128, [[CONV]]
11 ; CHECK-NEXT: [[CONV1:%.*]] = trunc i64 [[SUB]] to i32
12 ; CHECK-NEXT: [[CONV2:%.*]] = zext i64 %Val to i128
13 ; CHECK-NEXT: [[SH_PROM:%.*]] = zext i32 [[CONV1]] to i128
14 ; CHECK-NEXT: [[SHL:%.*]] = shl i128 [[CONV2]], [[SH_PROM]]
15 ; CHECK-NEXT: [[SHR:%.*]] = ashr i128 [[SHL]], [[SH_PROM]]
16 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i128 [[SHR]], 0
17 ; CHECK-NEXT: ret i1 [[CMP]]
20 %conv = zext i32 %IntegerBitWidth to i64
21 %sub = sub i64 128, %conv
22 %conv1 = trunc i64 %sub to i32
23 %conv2 = zext i64 %Val to i128
24 %sh_prom = zext i32 %conv1 to i128
25 %shl = shl i128 %conv2, %sh_prom
26 %shr = ashr i128 %shl, %sh_prom
27 %cmp = icmp slt i128 %shr, 0