1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O2 \ 3; RUN: -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s --check-prefix CHECK-BE \ 4; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl 5; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \ 6; RUN: -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s --check-prefix CHECK-LE \ 7; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl 8; ModuleID = 'ComparisonTestCases/testComparesieqsc.c' 9 10@glob = local_unnamed_addr global i8 0, align 1 11 12; Function Attrs: norecurse nounwind readnone 13define signext i32 @test_ieqsc(i8 signext %a, i8 signext %b) { 14; CHECK-LABEL: test_ieqsc: 15; CHECK: # %bb.0: # %entry 16; CHECK-NEXT: xor r3, r3, r4 17; CHECK-NEXT: cntlzw r3, r3 18; CHECK-NEXT: srwi r3, r3, 5 19; CHECK-NEXT: blr 20; CHECK-BE-LABEL: test_ieqsc: 21; CHECK-BE: # %bb.0: # %entry 22; CHECK-BE-NEXT: xor r3, r3, r4 23; CHECK-BE-NEXT: cntlzw r3, r3 24; CHECK-BE-NEXT: srwi r3, r3, 5 25; CHECK-BE-NEXT: blr 26; 27; CHECK-LE-LABEL: test_ieqsc: 28; CHECK-LE: # %bb.0: # %entry 29; CHECK-LE-NEXT: xor r3, r3, r4 30; CHECK-LE-NEXT: cntlzw r3, r3 31; CHECK-LE-NEXT: srwi r3, r3, 5 32; CHECK-LE-NEXT: blr 33entry: 34 %cmp = icmp eq i8 %a, %b 35 %conv2 = zext i1 %cmp to i32 36 ret i32 %conv2 37} 38 39; Function Attrs: norecurse nounwind readnone 40define signext i32 @test_ieqsc_sext(i8 signext %a, i8 signext %b) { 41; CHECK-LABEL: test_ieqsc_sext: 42; CHECK: # %bb.0: # %entry 43; CHECK-NEXT: xor r3, r3, r4 44; CHECK-NEXT: cntlzw r3, r3 45; CHECK-NEXT: srwi r3, r3, 5 46; CHECK-NEXT: neg r3, r3 47; CHECK-NEXT: blr 48; CHECK-BE-LABEL: test_ieqsc_sext: 49; CHECK-BE: # %bb.0: # %entry 50; CHECK-BE-NEXT: xor r3, r3, r4 51; CHECK-BE-NEXT: cntlzw r3, r3 52; CHECK-BE-NEXT: srwi r3, r3, 5 53; CHECK-BE-NEXT: neg r3, r3 54; CHECK-BE-NEXT: blr 55; 56; CHECK-LE-LABEL: test_ieqsc_sext: 57; CHECK-LE: # %bb.0: # %entry 58; CHECK-LE-NEXT: xor r3, r3, r4 59; CHECK-LE-NEXT: cntlzw r3, r3 60; CHECK-LE-NEXT: srwi r3, r3, 5 61; CHECK-LE-NEXT: neg r3, r3 62; CHECK-LE-NEXT: blr 63entry: 64 %cmp = icmp eq i8 %a, %b 65 %sub = sext i1 %cmp to i32 66 ret i32 %sub 67} 68 69; Function Attrs: norecurse nounwind readnone 70define signext i32 @test_ieqsc_z(i8 signext %a) { 71; CHECK-LABEL: test_ieqsc_z: 72; CHECK: # %bb.0: # %entry 73; CHECK-NEXT: cntlzw r3, r3 74; CHECK-NEXT: srwi r3, r3, 5 75; CHECK-NEXT: blr 76; CHECK-BE-LABEL: test_ieqsc_z: 77; CHECK-BE: # %bb.0: # %entry 78; CHECK-BE-NEXT: cntlzw r3, r3 79; CHECK-BE-NEXT: srwi r3, r3, 5 80; CHECK-BE-NEXT: blr 81; 82; CHECK-LE-LABEL: test_ieqsc_z: 83; CHECK-LE: # %bb.0: # %entry 84; CHECK-LE-NEXT: cntlzw r3, r3 85; CHECK-LE-NEXT: srwi r3, r3, 5 86; CHECK-LE-NEXT: blr 87entry: 88 %cmp = icmp eq i8 %a, 0 89 %conv1 = zext i1 %cmp to i32 90 ret i32 %conv1 91} 92 93; Function Attrs: norecurse nounwind readnone 94define signext i32 @test_ieqsc_sext_z(i8 signext %a) { 95; CHECK-LABEL: test_ieqsc_sext_z: 96; CHECK: # %bb.0: # %entry 97; CHECK-NEXT: cntlzw r3, r3 98; CHECK-NEXT: srwi r3, r3, 5 99; CHECK-NEXT: neg r3, r3 100; CHECK-NEXT: blr 101; CHECK-BE-LABEL: test_ieqsc_sext_z: 102; CHECK-BE: # %bb.0: # %entry 103; CHECK-BE-NEXT: cntlzw r3, r3 104; CHECK-BE-NEXT: srwi r3, r3, 5 105; CHECK-BE-NEXT: neg r3, r3 106; CHECK-BE-NEXT: blr 107; 108; CHECK-LE-LABEL: test_ieqsc_sext_z: 109; CHECK-LE: # %bb.0: # %entry 110; CHECK-LE-NEXT: cntlzw r3, r3 111; CHECK-LE-NEXT: srwi r3, r3, 5 112; CHECK-LE-NEXT: neg r3, r3 113; CHECK-LE-NEXT: blr 114entry: 115 %cmp = icmp eq i8 %a, 0 116 %sub = sext i1 %cmp to i32 117 ret i32 %sub 118} 119 120; Function Attrs: norecurse nounwind 121define void @test_ieqsc_store(i8 signext %a, i8 signext %b) { 122; CHECK-LABEL: test_ieqsc_store: 123; CHECK: # %bb.0: # %entry 124; CHECK-NEXT: xor r3, r3, r4 125; CHECK-NEXT: addis r5, r2, glob@toc@ha 126; CHECK-NEXT: cntlzw r3, r3 127; CHECK-NEXT: srwi r3, r3, 5 128; CHECK-NEXT: stb r3, glob@toc@l(r5) 129; CHECK-NEXT: blr 130; CHECK-BE-LABEL: test_ieqsc_store: 131; CHECK-BE: # %bb.0: # %entry 132; CHECK-BE-NEXT: addis r5, r2, .LC0@toc@ha 133; CHECK-BE-NEXT: xor r3, r3, r4 134; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r5) 135; CHECK-BE-NEXT: cntlzw r3, r3 136; CHECK-BE-NEXT: srwi r3, r3, 5 137; CHECK-BE-NEXT: stb r3, 0(r4) 138; CHECK-BE-NEXT: blr 139; 140; CHECK-LE-LABEL: test_ieqsc_store: 141; CHECK-LE: # %bb.0: # %entry 142; CHECK-LE-NEXT: xor r3, r3, r4 143; CHECK-LE-NEXT: addis r5, r2, glob@toc@ha 144; CHECK-LE-NEXT: cntlzw r3, r3 145; CHECK-LE-NEXT: srwi r3, r3, 5 146; CHECK-LE-NEXT: stb r3, glob@toc@l(r5) 147; CHECK-LE-NEXT: blr 148entry: 149 %cmp = icmp eq i8 %a, %b 150 %conv3 = zext i1 %cmp to i8 151 store i8 %conv3, i8* @glob, align 1 152 ret void 153} 154 155; Function Attrs: norecurse nounwind 156define void @test_ieqsc_sext_store(i8 signext %a, i8 signext %b) { 157; CHECK-LABEL: test_ieqsc_sext_store: 158; CHECK: # %bb.0: # %entry 159; CHECK-NEXT: xor r3, r3, r4 160; CHECK-NEXT: addis r5, r2, glob@toc@ha 161; CHECK-NEXT: cntlzw r3, r3 162; CHECK-NEXT: srwi r3, r3, 5 163; CHECK-NEXT: neg r3, r3 164; CHECK-NEXT: stb r3, glob@toc@l(r5) 165; CHECK-NEXT: blr 166; CHECK-BE-LABEL: test_ieqsc_sext_store: 167; CHECK-BE: # %bb.0: # %entry 168; CHECK-BE-NEXT: addis r5, r2, .LC0@toc@ha 169; CHECK-BE-NEXT: xor r3, r3, r4 170; CHECK-BE-NEXT: cntlzw r3, r3 171; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r5) 172; CHECK-BE-NEXT: srwi r3, r3, 5 173; CHECK-BE-NEXT: neg r3, r3 174; CHECK-BE-NEXT: stb r3, 0(r4) 175; CHECK-BE-NEXT: blr 176; 177; CHECK-LE-LABEL: test_ieqsc_sext_store: 178; CHECK-LE: # %bb.0: # %entry 179; CHECK-LE-NEXT: xor r3, r3, r4 180; CHECK-LE-NEXT: addis r5, r2, glob@toc@ha 181; CHECK-LE-NEXT: cntlzw r3, r3 182; CHECK-LE-NEXT: srwi r3, r3, 5 183; CHECK-LE-NEXT: neg r3, r3 184; CHECK-LE-NEXT: stb r3, glob@toc@l(r5) 185; CHECK-LE-NEXT: blr 186entry: 187 %cmp = icmp eq i8 %a, %b 188 %conv3 = sext i1 %cmp to i8 189 store i8 %conv3, i8* @glob, align 1 190 ret void 191} 192 193; Function Attrs: norecurse nounwind 194define void @test_ieqsc_z_store(i8 signext %a) { 195; CHECK-LABEL: test_ieqsc_z_store: 196; CHECK: # %bb.0: # %entry 197; CHECK-NEXT: cntlzw r3, r3 198; CHECK-NEXT: addis r4, r2, glob@toc@ha 199; CHECK-NEXT: srwi r3, r3, 5 200; CHECK-NEXT: stb r3, glob@toc@l(r4) 201; CHECK-NEXT: blr 202; CHECK-BE-LABEL: test_ieqsc_z_store: 203; CHECK-BE: # %bb.0: # %entry 204; CHECK-BE-NEXT: addis r4, r2, .LC0@toc@ha 205; CHECK-BE-NEXT: cntlzw r3, r3 206; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r4) 207; CHECK-BE-NEXT: srwi r3, r3, 5 208; CHECK-BE-NEXT: stb r3, 0(r4) 209; CHECK-BE-NEXT: blr 210; 211; CHECK-LE-LABEL: test_ieqsc_z_store: 212; CHECK-LE: # %bb.0: # %entry 213; CHECK-LE-NEXT: cntlzw r3, r3 214; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha 215; CHECK-LE-NEXT: srwi r3, r3, 5 216; CHECK-LE-NEXT: stb r3, glob@toc@l(r4) 217; CHECK-LE-NEXT: blr 218entry: 219 %cmp = icmp eq i8 %a, 0 220 %conv2 = zext i1 %cmp to i8 221 store i8 %conv2, i8* @glob, align 1 222 ret void 223} 224 225; Function Attrs: norecurse nounwind 226define void @test_ieqsc_sext_z_store(i8 signext %a) { 227; CHECK-LABEL: test_ieqsc_sext_z_store: 228; CHECK: # %bb.0: # %entry 229; CHECK-NEXT: cntlzw r3, r3 230; CHECK-NEXT: addis r4, r2, glob@toc@ha 231; CHECK-NEXT: srwi r3, r3, 5 232; CHECK-NEXT: neg r3, r3 233; CHECK-NEXT: stb r3, glob@toc@l(r4) 234; CHECK-NEXT: blr 235; CHECK-BE-LABEL: test_ieqsc_sext_z_store: 236; CHECK-BE: # %bb.0: # %entry 237; CHECK-BE-NEXT: addis r4, r2, .LC0@toc@ha 238; CHECK-BE-NEXT: cntlzw r3, r3 239; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r4) 240; CHECK-BE-NEXT: srwi r3, r3, 5 241; CHECK-BE-NEXT: neg r3, r3 242; CHECK-BE-NEXT: stb r3, 0(r4) 243; CHECK-BE-NEXT: blr 244; 245; CHECK-LE-LABEL: test_ieqsc_sext_z_store: 246; CHECK-LE: # %bb.0: # %entry 247; CHECK-LE-NEXT: cntlzw r3, r3 248; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha 249; CHECK-LE-NEXT: srwi r3, r3, 5 250; CHECK-LE-NEXT: neg r3, r3 251; CHECK-LE-NEXT: stb r3, glob@toc@l(r4) 252; CHECK-LE-NEXT: blr 253entry: 254 %cmp = icmp eq i8 %a, 0 255 %conv2 = sext i1 %cmp to i8 256 store i8 %conv2, i8* @glob, align 1 257 ret void 258} 259