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: --check-prefixes=CHECK,BE 6; RUN: llc -relocation-model=pic -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \ 7; RUN: -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \ 8; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl \ 9; RUN: --check-prefixes=CHECK,LE 10; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \ 11; RUN: -ppc-asm-full-reg-names -mcpu=pwr10 < %s | \ 12; RUN: FileCheck %s --check-prefixes=CHECK-P10,CHECK-P10-LE 13; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O2 \ 14; RUN: -ppc-asm-full-reg-names -mcpu=pwr10 < %s | \ 15; RUN: FileCheck %s --check-prefixes=CHECK-P10,CHECK-P10-BE 16; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O2 \ 17; RUN: -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr10 < %s | \ 18; RUN: FileCheck %s --check-prefixes=CHECK-P10-CMP,CHECK-P10-CMP-LE \ 19; RUN: --implicit-check-not cmplw --implicit-check-not cmpld 20; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \ 21; RUN: -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr10 < %s | \ 22; RUN: FileCheck %s --check-prefixes=CHECK-P10-CMP,CHECK-P10-CMP-BE \ 23; RUN: --implicit-check-not cmplw --implicit-check-not cmpld 24 25%struct.tree_common = type { i8, [3 x i8] } 26declare signext i32 @fn2(...) local_unnamed_addr #1 27 28; Function Attrs: nounwind 29define dso_local i32 @testCompare1(%struct.tree_common* nocapture readonly %arg1) nounwind { 30; BE-LABEL: testCompare1: 31; BE: # %bb.0: # %entry 32; BE-NEXT: mflr r0 33; BE-NEXT: std r0, 16(r1) 34; BE-NEXT: stdu r1, -112(r1) 35; BE-NEXT: addis r4, r2, testCompare1@toc@ha 36; BE-NEXT: lbz r3, 0(r3) 37; BE-NEXT: lbz r4, testCompare1@toc@l(r4) 38; BE-NEXT: clrlwi r3, r3, 31 39; BE-NEXT: clrlwi r4, r4, 31 40; BE-NEXT: clrldi r3, r3, 32 41; BE-NEXT: clrldi r4, r4, 32 42; BE-NEXT: sub r3, r3, r4 43; BE-NEXT: rldicl r3, r3, 1, 63 44; BE-NEXT: bl fn2 45; BE-NEXT: nop 46; BE-NEXT: addi r1, r1, 112 47; BE-NEXT: ld r0, 16(r1) 48; BE-NEXT: mtlr r0 49; BE-NEXT: blr 50; 51; LE-LABEL: testCompare1: 52; LE: # %bb.0: # %entry 53; LE-NEXT: mflr r0 54; LE-NEXT: std r0, 16(r1) 55; LE-NEXT: stdu r1, -32(r1) 56; LE-NEXT: addis r4, r2, testCompare1@toc@ha 57; LE-NEXT: lbz r3, 0(r3) 58; LE-NEXT: lbz r4, testCompare1@toc@l(r4) 59; LE-NEXT: clrlwi r3, r3, 31 60; LE-NEXT: clrlwi r4, r4, 31 61; LE-NEXT: clrldi r3, r3, 32 62; LE-NEXT: clrldi r4, r4, 32 63; LE-NEXT: sub r3, r3, r4 64; LE-NEXT: rldicl r3, r3, 1, 63 65; LE-NEXT: bl fn2 66; LE-NEXT: nop 67; LE-NEXT: addi r1, r1, 32 68; LE-NEXT: ld r0, 16(r1) 69; LE-NEXT: mtlr r0 70; LE-NEXT: blr 71; 72; CHECK-P10-LE-LABEL: testCompare1: 73; CHECK-P10-LE: .localentry testCompare1, 1 74; CHECK-P10-LE-NEXT: # %bb.0: # %entry 75; CHECK-P10-LE-NEXT: plbz r4, testCompare1@PCREL(0), 1 76; CHECK-P10-LE-NEXT: lbz r3, 0(r3) 77; CHECK-P10-LE-NEXT: clrlwi r3, r3, 31 78; CHECK-P10-LE-NEXT: clrlwi r4, r4, 31 79; CHECK-P10-LE-NEXT: cmplw r4, r3 80; CHECK-P10-LE-NEXT: setbc r3, gt 81; CHECK-P10-LE-NEXT: b fn2@notoc 82; CHECK-P10-LE-NEXT: #TC_RETURNd8 fn2@notoc 0 83; 84; CHECK-P10-BE-LABEL: testCompare1: 85; CHECK-P10-BE: # %bb.0: # %entry 86; CHECK-P10-BE-NEXT: mflr r0 87; CHECK-P10-BE-NEXT: std r0, 16(r1) 88; CHECK-P10-BE-NEXT: stdu r1, -112(r1) 89; CHECK-P10-BE-NEXT: addis r4, r2, testCompare1@toc@ha 90; CHECK-P10-BE-NEXT: lbz r3, 0(r3) 91; CHECK-P10-BE-NEXT: lbz r4, testCompare1@toc@l(r4) 92; CHECK-P10-BE-NEXT: clrlwi r3, r3, 31 93; CHECK-P10-BE-NEXT: clrlwi r4, r4, 31 94; CHECK-P10-BE-NEXT: cmplw r4, r3 95; CHECK-P10-BE-NEXT: setbc r3, gt 96; CHECK-P10-BE-NEXT: bl fn2 97; CHECK-P10-BE-NEXT: nop 98; CHECK-P10-BE-NEXT: addi r1, r1, 112 99; CHECK-P10-BE-NEXT: ld r0, 16(r1) 100; CHECK-P10-BE-NEXT: mtlr r0 101; CHECK-P10-BE-NEXT: blr 102; 103; CHECK-P10-CMP-LE-LABEL: testCompare1: 104; CHECK-P10-CMP-LE: # %bb.0: # %entry 105; CHECK-P10-CMP-LE-NEXT: mflr r0 106; CHECK-P10-CMP-LE-NEXT: std r0, 16(r1) 107; CHECK-P10-CMP-LE-NEXT: stdu r1, -112(r1) 108; CHECK-P10-CMP-LE-NEXT: addis r4, r2, testCompare1@toc@ha 109; CHECK-P10-CMP-LE-NEXT: lbz r3, 0(r3) 110; CHECK-P10-CMP-LE-NEXT: lbz r4, testCompare1@toc@l(r4) 111; CHECK-P10-CMP-LE-NEXT: clrlwi r3, r3, 31 112; CHECK-P10-CMP-LE-NEXT: clrlwi r4, r4, 31 113; CHECK-P10-CMP-LE-NEXT: clrldi r3, r3, 32 114; CHECK-P10-CMP-LE-NEXT: clrldi r4, r4, 32 115; CHECK-P10-CMP-LE-NEXT: sub r3, r3, r4 116; CHECK-P10-CMP-LE-NEXT: rldicl r3, r3, 1, 63 117; CHECK-P10-CMP-LE-NEXT: bl fn2 118; CHECK-P10-CMP-LE-NEXT: nop 119; CHECK-P10-CMP-LE-NEXT: addi r1, r1, 112 120; CHECK-P10-CMP-LE-NEXT: ld r0, 16(r1) 121; CHECK-P10-CMP-LE-NEXT: mtlr r0 122; CHECK-P10-CMP-LE-NEXT: blr 123; 124; CHECK-P10-CMP-BE-LABEL: testCompare1: 125; CHECK-P10-CMP-BE: .localentry testCompare1, 1 126; CHECK-P10-CMP-BE-NEXT: # %bb.0: # %entry 127; CHECK-P10-CMP-BE-NEXT: plbz r4, testCompare1@PCREL(0), 1 128; CHECK-P10-CMP-BE-NEXT: lbz r3, 0(r3) 129; CHECK-P10-CMP-BE-NEXT: clrlwi r3, r3, 31 130; CHECK-P10-CMP-BE-NEXT: clrlwi r4, r4, 31 131; CHECK-P10-CMP-BE-NEXT: clrldi r3, r3, 32 132; CHECK-P10-CMP-BE-NEXT: clrldi r4, r4, 32 133; CHECK-P10-CMP-BE-NEXT: sub r3, r3, r4 134; CHECK-P10-CMP-BE-NEXT: rldicl r3, r3, 1, 63 135; CHECK-P10-CMP-BE-NEXT: b fn2@notoc 136; CHECK-P10-CMP-BE-NEXT: #TC_RETURNd8 fn2@notoc 0 137 138entry: 139 %bf.load = load i8, i8* bitcast (i32 (%struct.tree_common*)* @testCompare1 to i8*), align 4 140 %bf.clear = and i8 %bf.load, 1 141 %0 = getelementptr inbounds %struct.tree_common, %struct.tree_common* %arg1, i64 0, i32 0 142 %bf.load1 = load i8, i8* %0, align 4 143 %bf.clear2 = and i8 %bf.load1, 1 144 %cmp = icmp ugt i8 %bf.clear, %bf.clear2 145 %conv = zext i1 %cmp to i32 146 %call = tail call signext i32 bitcast (i32 (...)* @fn2 to i32 (i32)*)(i32 signext %conv) #2 147 ret i32 undef 148} 149 150; Function Attrs: norecurse nounwind readnone 151define dso_local signext i32 @testCompare2(i32 zeroext %a, i32 zeroext %b) { 152; CHECK-LABEL: testCompare2: 153; CHECK: # %bb.0: # %entry 154; CHECK-NEXT: clrlwi r3, r3, 31 155; CHECK-NEXT: clrlwi r4, r4, 31 156; CHECK-NEXT: clrldi r3, r3, 32 157; CHECK-NEXT: clrldi r4, r4, 32 158; CHECK-NEXT: sub r3, r4, r3 159; CHECK-NEXT: rldicl r3, r3, 1, 63 160; CHECK-NEXT: blr 161; 162; CHECK-P10-LABEL: testCompare2: 163; CHECK-P10: # %bb.0: # %entry 164; CHECK-P10-NEXT: clrlwi r3, r3, 31 165; CHECK-P10-NEXT: clrlwi r4, r4, 31 166; CHECK-P10-NEXT: cmplw r3, r4 167; CHECK-P10-NEXT: setbc r3, gt 168; CHECK-P10-NEXT: blr 169; 170; CHECK-P10-CMP-LABEL: testCompare2: 171; CHECK-P10-CMP: # %bb.0: # %entry 172; CHECK-P10-CMP-NEXT: clrlwi r3, r3, 31 173; CHECK-P10-CMP-NEXT: clrlwi r4, r4, 31 174; CHECK-P10-CMP-NEXT: clrldi r3, r3, 32 175; CHECK-P10-CMP-NEXT: clrldi r4, r4, 32 176; CHECK-P10-CMP-NEXT: sub r3, r4, r3 177; CHECK-P10-CMP-NEXT: rldicl r3, r3, 1, 63 178; CHECK-P10-CMP-NEXT: blr 179 180entry: 181 %and = and i32 %a, 1 182 %and1 = and i32 %b, 1 183 %cmp = icmp ugt i32 %and, %and1 184 %conv = zext i1 %cmp to i32 185 ret i32 %conv 186} 187