1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc -relocation-model=pic -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O2 \ 3; RUN: -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \ 4; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl 5; RUN: llc -relocation-model=pic -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \ 6; RUN: -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \ 7; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl 8 9@glob = local_unnamed_addr global i64 0, align 8 10 11; Function Attrs: norecurse nounwind readnone 12define signext i32 @test_igtsll(i64 %a, i64 %b) { 13; CHECK-LABEL: test_igtsll: 14; CHECK: # %bb.0: # %entry 15; CHECK-NEXT: sradi r5, r4, 63 16; CHECK-NEXT: rldicl r6, r3, 1, 63 17; CHECK-NEXT: subc r3, r4, r3 18; CHECK-NEXT: adde r3, r6, r5 19; CHECK-NEXT: xori r3, r3, 1 20; CHECK-NEXT: blr 21entry: 22 %cmp = icmp sgt i64 %a, %b 23 %conv = zext i1 %cmp to i32 24 ret i32 %conv 25} 26 27; Function Attrs: norecurse nounwind readnone 28define signext i32 @test_igtsll_sext(i64 %a, i64 %b) { 29; CHECK-LABEL: test_igtsll_sext: 30; CHECK: # %bb.0: # %entry 31; CHECK-NEXT: sradi r5, r4, 63 32; CHECK-NEXT: rldicl r6, r3, 1, 63 33; CHECK-NEXT: subc r3, r4, r3 34; CHECK-NEXT: adde r3, r6, r5 35; CHECK-NEXT: xori r3, r3, 1 36; CHECK-NEXT: neg r3, r3 37; CHECK-NEXT: blr 38entry: 39 %cmp = icmp sgt i64 %a, %b 40 %sub = sext i1 %cmp to i32 41 ret i32 %sub 42} 43 44; FIXME 45; Function Attrs: norecurse nounwind readnone 46define signext i32 @test_igtsll_z(i64 %a) { 47; CHECK-LABEL: test_igtsll_z: 48; CHECK: # %bb.0: # %entry 49; CHECK-NEXT: addi r4, r3, -1 50; CHECK-NEXT: nor r3, r4, r3 51; CHECK-NEXT: rldicl r3, r3, 1, 63 52; CHECK-NEXT: blr 53entry: 54 %cmp = icmp sgt i64 %a, 0 55 %conv = zext i1 %cmp to i32 56 ret i32 %conv 57} 58 59; Function Attrs: norecurse nounwind readnone 60define signext i32 @test_igtsll_sext_z(i64 %a) { 61; CHECK-LABEL: test_igtsll_sext_z: 62; CHECK: # %bb.0: # %entry 63; CHECK-NEXT: addi r4, r3, -1 64; CHECK-NEXT: nor r3, r4, r3 65; CHECK-NEXT: sradi r3, r3, 63 66; CHECK-NEXT: blr 67entry: 68 %cmp = icmp sgt i64 %a, 0 69 %sub = sext i1 %cmp to i32 70 ret i32 %sub 71} 72 73; Function Attrs: norecurse nounwind 74define void @test_igtsll_store(i64 %a, i64 %b) { 75; CHECK-LABEL: test_igtsll_store: 76; CHECK: # %bb.0: # %entry 77; CHECK-NEXT: sradi r6, r4, 63 78; CHECK-NEXT: addis r5, r2, .LC0@toc@ha 79; CHECK-NEXT: subc r4, r4, r3 80; CHECK-NEXT: rldicl r3, r3, 1, 63 81; CHECK-NEXT: ld r4, .LC0@toc@l(r5) 82; CHECK-NEXT: adde r3, r3, r6 83; CHECK-NEXT: xori r3, r3, 1 84; CHECK-NEXT: std r3, 0(r4) 85; CHECK-NEXT: blr 86; CHECK-DIAG: subfc [[REG3:r[0-9]+]], r3, r4 87entry: 88 %cmp = icmp sgt i64 %a, %b 89 %conv1 = zext i1 %cmp to i64 90 store i64 %conv1, i64* @glob, align 8 91 ret void 92} 93 94; Function Attrs: norecurse nounwind 95define void @test_igtsll_sext_store(i64 %a, i64 %b) { 96; CHECK-LABEL: test_igtsll_sext_store: 97; CHECK: # %bb.0: # %entry 98; CHECK-NEXT: sradi r6, r4, 63 99; CHECK-NEXT: addis r5, r2, .LC0@toc@ha 100; CHECK-NEXT: subc r4, r4, r3 101; CHECK-NEXT: rldicl r3, r3, 1, 63 102; CHECK-NEXT: adde r3, r3, r6 103; CHECK-NEXT: ld r4, .LC0@toc@l(r5) 104; CHECK-NEXT: xori r3, r3, 1 105; CHECK-NEXT: neg r3, r3 106; CHECK-NEXT: std r3, 0(r4) 107; CHECK-NEXT: blr 108; CHECK-DIAG: subfc [[REG3:r[0-9]+]], r3, r4 109entry: 110 %cmp = icmp sgt i64 %a, %b 111 %conv1 = sext i1 %cmp to i64 112 store i64 %conv1, i64* @glob, align 8 113 ret void 114} 115 116; FIXME 117; Function Attrs: norecurse nounwind 118define void @test_igtsll_z_store(i64 %a) { 119; CHECK-LABEL: test_igtsll_z_store: 120; CHECK: # %bb.0: # %entry 121; CHECK-NEXT: addis r4, r2, .LC0@toc@ha 122; CHECK-NEXT: addi r5, r3, -1 123; CHECK-NEXT: ld r4, .LC0@toc@l(r4) 124; CHECK-NEXT: nor r3, r5, r3 125; CHECK-NEXT: rldicl r3, r3, 1, 63 126; CHECK-NEXT: std r3, 0(r4) 127; CHECK-NEXT: blr 128entry: 129 %cmp = icmp sgt i64 %a, 0 130 %conv1 = zext i1 %cmp to i64 131 store i64 %conv1, i64* @glob, align 8 132 ret void 133} 134 135; Function Attrs: norecurse nounwind 136define void @test_igtsll_sext_z_store(i64 %a) { 137; CHECK-LABEL: test_igtsll_sext_z_store: 138; CHECK: # %bb.0: # %entry 139; CHECK-NEXT: addis r4, r2, .LC0@toc@ha 140; CHECK-NEXT: addi r5, r3, -1 141; CHECK-NEXT: ld r4, .LC0@toc@l(r4) 142; CHECK-NEXT: nor r3, r5, r3 143; CHECK-NEXT: sradi r3, r3, 63 144; CHECK-NEXT: std r3, 0(r4) 145; CHECK-NEXT: blr 146entry: 147 %cmp = icmp sgt i64 %a, 0 148 %conv1 = sext i1 %cmp to i64 149 store i64 %conv1, i64* @glob, align 8 150 ret void 151} 152