1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=powerpc64-unknown-unknown %s -o - | FileCheck %s
3
4define dso_local fastcc void @trunc_srl_load(i32 zeroext %AttrArgNo) {
5; CHECK-LABEL: trunc_srl_load:
6; CHECK:       # %bb.0: # %entry
7; CHECK-NEXT:    lhz 4, 2(0)
8; CHECK-NEXT:    cmplw 4, 3
9; CHECK-NEXT:    ble 0, .LBB0_2
10; CHECK-NEXT:  # %bb.1: # %exit
11; CHECK-NEXT:  .LBB0_2: # %cond.false
12entry:
13  %bf.load.i = load i64, i64* null, align 8
14  %bf.lshr.i = lshr i64 %bf.load.i, 32
15  %0 = trunc i64 %bf.lshr.i to i32
16  %bf.cast.i = and i32 %0, 65535
17  %cmp.i = icmp ugt i32 %bf.cast.i, %AttrArgNo
18  br i1 %cmp.i, label %exit, label %cond.false
19exit:       ; preds = %entry
20  unreachable
21cond.false:                                       ; preds = %entry
22  unreachable
23}
24
25define i32 @sh_trunc_sh(i64 %x) {
26; CHECK-LABEL: sh_trunc_sh:
27; CHECK:       # %bb.0:
28; CHECK-NEXT:    rldicl 3, 3, 47, 36
29; CHECK-NEXT:    blr
30  %s = lshr i64 %x, 13
31  %t = trunc i64 %s to i32
32  %r = lshr i32 %t, 4
33  ret i32 %r
34}
35