1; RUN: llc -verify-machineinstrs -O2 < %s | FileCheck %s 2target datalayout = "e-m:e-i64:64-n32:64" 3target triple = "powerpc64le-unknown-linux-gnu" 4 5; CHECK-LABEL: test1 6define i8 @test1(i32 %a) { 7entry: 8; CHECK-NOT: rlwinm {{{[0-9]+}}}, {{[0-9]+}}, 0, 24, 27 9; CHECK: andi. [[REG:[0-9]+]], {{[0-9]+}}, 240 10; CHECK-NOT: cmplwi [[REG]], 0 11; CHECK: beq 0 12 %0 = and i32 %a, 240 13 %1 = icmp eq i32 %0, 0 14 br i1 %1, label %eq0, label %neq0 15eq0: 16 ret i8 102 17neq0: 18 ret i8 116 19} 20 21; CHECK-LABEL: test2 22define i8 @test2(i32 %a) { 23entry: 24; CHECK: rlwinm [[REG:[0-9]+]], {{[0-9]+}}, 0, 28, 23 25; CHECK: cmplwi [[REG]], 0 26; CHECK: beq 0 27 %0 = and i32 %a, -241 28 %1 = icmp eq i32 %0, 0 29 br i1 %1, label %eq0, label %neq0 30eq0: 31 ret i8 102 32neq0: 33 ret i8 116 34} 35 36declare {i32, i1} @llvm.ssub.with.overflow.i32(i32 %a, i32 %b) 37 38; CHECK-LABEL: test3 39define i8 @test3(i32 %a, i32 %b) { 40entry: 41; CHECK-NOT: rlwnm {{{[0-9]+}}}, {{[0-9]+}}, {{{[0-9]+}}}, 28, 31 42; CHECK: rlwnm. [[REG:[0-9]+]], {{[0-9]+}}, 4, 28, 31 43; CHECK-NOT: cmplwi [[REG]], 0 44; CHECK: beq 0 45 %left = shl i32 %a, %b 46 %res = call {i32, i1} @llvm.ssub.with.overflow.i32(i32 32, i32 %b) 47 %right_amount = extractvalue {i32, i1} %res, 0 48 %right = lshr i32 %a, %right_amount 49 %0 = or i32 %left, %right 50 %1 = and i32 %0, 15 51 %2 = icmp eq i32 %1, 0 52 br i1 %2, label %eq0, label %neq0 53eq0: 54 ret i8 102 55neq0: 56 ret i8 116 57} 58