1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc -mcpu=pwr9 -mtriple=powerpc64le-unknown-unknown -verify-machineinstrs \ 3; RUN: -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names < %s | FileCheck %s 4; RUN: llc -mcpu=pwr8 -mtriple=powerpc64le-unknown-unknown -verify-machineinstrs \ 5; RUN: -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names < %s | FileCheck %s \ 6; RUN: -check-prefix=CHECK-P8 7 8define void @qp_trunc(fp128* nocapture readonly %a, fp128* nocapture %res) { 9; CHECK-LABEL: qp_trunc: 10; CHECK: # %bb.0: # %entry 11; CHECK-NEXT: lxv v2, 0(r3) 12; CHECK-NEXT: xsrqpi 1, v2, v2, 1 13; CHECK-NEXT: stxv v2, 0(r4) 14; CHECK-NEXT: blr 15; 16; CHECK-P8-LABEL: qp_trunc: 17; CHECK-P8: # %bb.0: # %entry 18; CHECK-P8-NEXT: mflr r0 19; CHECK-P8-NEXT: .cfi_def_cfa_offset 48 20; CHECK-P8-NEXT: .cfi_offset lr, 16 21; CHECK-P8-NEXT: .cfi_offset r30, -16 22; CHECK-P8-NEXT: std r30, -16(r1) # 8-byte Folded Spill 23; CHECK-P8-NEXT: std r0, 16(r1) 24; CHECK-P8-NEXT: stdu r1, -48(r1) 25; CHECK-P8-NEXT: ld r5, 0(r3) 26; CHECK-P8-NEXT: ld r6, 8(r3) 27; CHECK-P8-NEXT: mr r30, r4 28; CHECK-P8-NEXT: mr r3, r5 29; CHECK-P8-NEXT: mr r4, r6 30; CHECK-P8-NEXT: bl truncl 31; CHECK-P8-NEXT: nop 32; CHECK-P8-NEXT: std r3, 0(r30) 33; CHECK-P8-NEXT: std r4, 8(r30) 34; CHECK-P8-NEXT: addi r1, r1, 48 35; CHECK-P8-NEXT: ld r0, 16(r1) 36; CHECK-P8-NEXT: ld r30, -16(r1) # 8-byte Folded Reload 37; CHECK-P8-NEXT: mtlr r0 38; CHECK-P8-NEXT: blr 39entry: 40 %0 = load fp128, fp128* %a, align 16 41 %1 = tail call fp128 @llvm.trunc.f128(fp128 %0) 42 store fp128 %1, fp128* %res, align 16 43 ret void 44} 45declare fp128 @llvm.trunc.f128(fp128 %Val) 46 47define void @qp_rint(fp128* nocapture readonly %a, fp128* nocapture %res) { 48; CHECK-LABEL: qp_rint: 49; CHECK: # %bb.0: # %entry 50; CHECK-NEXT: lxv v2, 0(r3) 51; CHECK-NEXT: xsrqpix 0, v2, v2, 3 52; CHECK-NEXT: stxv v2, 0(r4) 53; CHECK-NEXT: blr 54; 55; CHECK-P8-LABEL: qp_rint: 56; CHECK-P8: # %bb.0: # %entry 57; CHECK-P8-NEXT: mflr r0 58; CHECK-P8-NEXT: .cfi_def_cfa_offset 48 59; CHECK-P8-NEXT: .cfi_offset lr, 16 60; CHECK-P8-NEXT: .cfi_offset r30, -16 61; CHECK-P8-NEXT: std r30, -16(r1) # 8-byte Folded Spill 62; CHECK-P8-NEXT: std r0, 16(r1) 63; CHECK-P8-NEXT: stdu r1, -48(r1) 64; CHECK-P8-NEXT: ld r5, 0(r3) 65; CHECK-P8-NEXT: ld r6, 8(r3) 66; CHECK-P8-NEXT: mr r30, r4 67; CHECK-P8-NEXT: mr r3, r5 68; CHECK-P8-NEXT: mr r4, r6 69; CHECK-P8-NEXT: bl rintl 70; CHECK-P8-NEXT: nop 71; CHECK-P8-NEXT: std r3, 0(r30) 72; CHECK-P8-NEXT: std r4, 8(r30) 73; CHECK-P8-NEXT: addi r1, r1, 48 74; CHECK-P8-NEXT: ld r0, 16(r1) 75; CHECK-P8-NEXT: ld r30, -16(r1) # 8-byte Folded Reload 76; CHECK-P8-NEXT: mtlr r0 77; CHECK-P8-NEXT: blr 78entry: 79 %0 = load fp128, fp128* %a, align 16 80 %1 = tail call fp128 @llvm.rint.f128(fp128 %0) 81 store fp128 %1, fp128* %res, align 16 82 ret void 83} 84declare fp128 @llvm.rint.f128(fp128 %Val) 85 86define void @qp_nearbyint(fp128* nocapture readonly %a, fp128* nocapture %res) { 87; CHECK-LABEL: qp_nearbyint: 88; CHECK: # %bb.0: # %entry 89; CHECK-NEXT: lxv v2, 0(r3) 90; CHECK-NEXT: xsrqpi 0, v2, v2, 3 91; CHECK-NEXT: stxv v2, 0(r4) 92; CHECK-NEXT: blr 93; 94; CHECK-P8-LABEL: qp_nearbyint: 95; CHECK-P8: # %bb.0: # %entry 96; CHECK-P8-NEXT: mflr r0 97; CHECK-P8-NEXT: .cfi_def_cfa_offset 48 98; CHECK-P8-NEXT: .cfi_offset lr, 16 99; CHECK-P8-NEXT: .cfi_offset r30, -16 100; CHECK-P8-NEXT: std r30, -16(r1) # 8-byte Folded Spill 101; CHECK-P8-NEXT: std r0, 16(r1) 102; CHECK-P8-NEXT: stdu r1, -48(r1) 103; CHECK-P8-NEXT: ld r5, 0(r3) 104; CHECK-P8-NEXT: ld r6, 8(r3) 105; CHECK-P8-NEXT: mr r30, r4 106; CHECK-P8-NEXT: mr r3, r5 107; CHECK-P8-NEXT: mr r4, r6 108; CHECK-P8-NEXT: bl nearbyintl 109; CHECK-P8-NEXT: nop 110; CHECK-P8-NEXT: std r3, 0(r30) 111; CHECK-P8-NEXT: std r4, 8(r30) 112; CHECK-P8-NEXT: addi r1, r1, 48 113; CHECK-P8-NEXT: ld r0, 16(r1) 114; CHECK-P8-NEXT: ld r30, -16(r1) # 8-byte Folded Reload 115; CHECK-P8-NEXT: mtlr r0 116; CHECK-P8-NEXT: blr 117entry: 118 %0 = load fp128, fp128* %a, align 16 119 %1 = tail call fp128 @llvm.nearbyint.f128(fp128 %0) 120 store fp128 %1, fp128* %res, align 16 121 ret void 122} 123declare fp128 @llvm.nearbyint.f128(fp128 %Val) 124 125define void @qp_round(fp128* nocapture readonly %a, fp128* nocapture %res) { 126; CHECK-LABEL: qp_round: 127; CHECK: # %bb.0: # %entry 128; CHECK-NEXT: lxv v2, 0(r3) 129; CHECK-NEXT: xsrqpi 0, v2, v2, 0 130; CHECK-NEXT: stxv v2, 0(r4) 131; CHECK-NEXT: blr 132; 133; CHECK-P8-LABEL: qp_round: 134; CHECK-P8: # %bb.0: # %entry 135; CHECK-P8-NEXT: mflr r0 136; CHECK-P8-NEXT: .cfi_def_cfa_offset 48 137; CHECK-P8-NEXT: .cfi_offset lr, 16 138; CHECK-P8-NEXT: .cfi_offset r30, -16 139; CHECK-P8-NEXT: std r30, -16(r1) # 8-byte Folded Spill 140; CHECK-P8-NEXT: std r0, 16(r1) 141; CHECK-P8-NEXT: stdu r1, -48(r1) 142; CHECK-P8-NEXT: ld r5, 0(r3) 143; CHECK-P8-NEXT: ld r6, 8(r3) 144; CHECK-P8-NEXT: mr r30, r4 145; CHECK-P8-NEXT: mr r3, r5 146; CHECK-P8-NEXT: mr r4, r6 147; CHECK-P8-NEXT: bl roundl 148; CHECK-P8-NEXT: nop 149; CHECK-P8-NEXT: std r3, 0(r30) 150; CHECK-P8-NEXT: std r4, 8(r30) 151; CHECK-P8-NEXT: addi r1, r1, 48 152; CHECK-P8-NEXT: ld r0, 16(r1) 153; CHECK-P8-NEXT: ld r30, -16(r1) # 8-byte Folded Reload 154; CHECK-P8-NEXT: mtlr r0 155; CHECK-P8-NEXT: blr 156entry: 157 %0 = load fp128, fp128* %a, align 16 158 %1 = tail call fp128 @llvm.round.f128(fp128 %0) 159 store fp128 %1, fp128* %res, align 16 160 ret void 161} 162declare fp128 @llvm.round.f128(fp128 %Val) 163 164define void @qp_floor(fp128* nocapture readonly %a, fp128* nocapture %res) { 165; CHECK-LABEL: qp_floor: 166; CHECK: # %bb.0: # %entry 167; CHECK-NEXT: lxv v2, 0(r3) 168; CHECK-NEXT: xsrqpi 1, v2, v2, 3 169; CHECK-NEXT: stxv v2, 0(r4) 170; CHECK-NEXT: blr 171; 172; CHECK-P8-LABEL: qp_floor: 173; CHECK-P8: # %bb.0: # %entry 174; CHECK-P8-NEXT: mflr r0 175; CHECK-P8-NEXT: .cfi_def_cfa_offset 48 176; CHECK-P8-NEXT: .cfi_offset lr, 16 177; CHECK-P8-NEXT: .cfi_offset r30, -16 178; CHECK-P8-NEXT: std r30, -16(r1) # 8-byte Folded Spill 179; CHECK-P8-NEXT: std r0, 16(r1) 180; CHECK-P8-NEXT: stdu r1, -48(r1) 181; CHECK-P8-NEXT: ld r5, 0(r3) 182; CHECK-P8-NEXT: ld r6, 8(r3) 183; CHECK-P8-NEXT: mr r30, r4 184; CHECK-P8-NEXT: mr r3, r5 185; CHECK-P8-NEXT: mr r4, r6 186; CHECK-P8-NEXT: bl floorl 187; CHECK-P8-NEXT: nop 188; CHECK-P8-NEXT: std r3, 0(r30) 189; CHECK-P8-NEXT: std r4, 8(r30) 190; CHECK-P8-NEXT: addi r1, r1, 48 191; CHECK-P8-NEXT: ld r0, 16(r1) 192; CHECK-P8-NEXT: ld r30, -16(r1) # 8-byte Folded Reload 193; CHECK-P8-NEXT: mtlr r0 194; CHECK-P8-NEXT: blr 195entry: 196 %0 = load fp128, fp128* %a, align 16 197 %1 = tail call fp128 @llvm.floor.f128(fp128 %0) 198 store fp128 %1, fp128* %res, align 16 199 ret void 200} 201declare fp128 @llvm.floor.f128(fp128 %Val) 202 203define void @qp_ceil(fp128* nocapture readonly %a, fp128* nocapture %res) { 204; CHECK-LABEL: qp_ceil: 205; CHECK: # %bb.0: # %entry 206; CHECK-NEXT: lxv v2, 0(r3) 207; CHECK-NEXT: xsrqpi 1, v2, v2, 2 208; CHECK-NEXT: stxv v2, 0(r4) 209; CHECK-NEXT: blr 210; 211; CHECK-P8-LABEL: qp_ceil: 212; CHECK-P8: # %bb.0: # %entry 213; CHECK-P8-NEXT: mflr r0 214; CHECK-P8-NEXT: .cfi_def_cfa_offset 48 215; CHECK-P8-NEXT: .cfi_offset lr, 16 216; CHECK-P8-NEXT: .cfi_offset r30, -16 217; CHECK-P8-NEXT: std r30, -16(r1) # 8-byte Folded Spill 218; CHECK-P8-NEXT: std r0, 16(r1) 219; CHECK-P8-NEXT: stdu r1, -48(r1) 220; CHECK-P8-NEXT: ld r5, 0(r3) 221; CHECK-P8-NEXT: ld r6, 8(r3) 222; CHECK-P8-NEXT: mr r30, r4 223; CHECK-P8-NEXT: mr r3, r5 224; CHECK-P8-NEXT: mr r4, r6 225; CHECK-P8-NEXT: bl ceill 226; CHECK-P8-NEXT: nop 227; CHECK-P8-NEXT: std r3, 0(r30) 228; CHECK-P8-NEXT: std r4, 8(r30) 229; CHECK-P8-NEXT: addi r1, r1, 48 230; CHECK-P8-NEXT: ld r0, 16(r1) 231; CHECK-P8-NEXT: ld r30, -16(r1) # 8-byte Folded Reload 232; CHECK-P8-NEXT: mtlr r0 233; CHECK-P8-NEXT: blr 234entry: 235 %0 = load fp128, fp128* %a, align 16 236 %1 = tail call fp128 @llvm.ceil.f128(fp128 %0) 237 store fp128 %1, fp128* %res, align 16 238 ret void 239} 240declare fp128 @llvm.ceil.f128(fp128 %Val) 241 242