1 ; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -verify-machineinstrs | FileCheck %s 2 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-f128:128:128-v128:128:128-n32:64" 3 target triple = "powerpc64-unknown-linux-gnu" 4 5 define i32 @test(i32 %a, i32 %b, i32 %c, i32 %d) { 6 entry: 7 %sext82 = shl i32 %d, 16 8 %conv29 = ashr exact i32 %sext82, 16 9 %cmp = icmp slt i32 %sext82, 0 10 br i1 %cmp, label %cond.true, label %cond.false 11 12 cond.true: ; preds = %sw.epilog 13 %and33 = and i32 %conv29, 32767 14 %sub34 = sub nsw i32 %a, %and33 15 br label %cond.end 16 17 cond.false: ; preds = %sw.epilog 18 %add37 = add nsw i32 %conv29, %a 19 br label %cond.end 20 21 ; CHECK: @test 22 ; CHECK: add [[REG:[0-9]+]], 23 ; CHECK: subf [[REG2:[0-9]+]], 24 ; CHECK: isel {{[0-9]+}}, [[REG]], [[REG2]], 25 26 cond.end: ; preds = %cond.false, %cond.true 27 %cond = phi i32 [ %sub34, %cond.true ], [ %add37, %cond.false ] 28 %sext83 = shl i32 %cond, 16 29 %conv39 = ashr exact i32 %sext83, 16 30 %add41 = sub i32 %b, %a 31 %sub43 = add i32 %add41, %conv39 32 ret i32 %sub43 33 } 34 35