313 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -enable-ppc-gen-scalar-mass -verify-machineinstrs -O3 -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck --check-prefix=CHECK-LNX %s3; RUN: llc -enable-ppc-gen-scalar-mass -verify-machineinstrs -O3 -mcpu=ppc -mtriple=powerpc-ibm-aix-xcoff < %s | FileCheck --check-prefix=CHECK-AIX %s4 5declare float @llvm.pow.f32 (float, float);6declare double @llvm.pow.f64 (double, double);7 8; fast-math powf with 0.259; TODO: pow->sqrt conversion for AIX10define float @llvmintr_powf_f32_fast025(float %a) #1 {11; CHECK-LNX-LABEL: llvmintr_powf_f32_fast025:12; CHECK-LNX: # %bb.0: # %entry13; CHECK-LNX-NEXT: xsrsqrtesp 2, 114; CHECK-LNX-NEXT: addis 3, 2, .LCPI0_0@toc@ha15; CHECK-LNX-NEXT: vspltisw 2, -316; CHECK-LNX-NEXT: lfs 0, .LCPI0_0@toc@l(3)17; CHECK-LNX-NEXT: addis 3, 2, .LCPI0_1@toc@ha18; CHECK-LNX-NEXT: xxlxor 5, 5, 519; CHECK-LNX-NEXT: xsmulsp 3, 1, 220; CHECK-LNX-NEXT: xsabsdp 1, 121; CHECK-LNX-NEXT: xsmulsp 4, 3, 022; CHECK-LNX-NEXT: xsmulsp 2, 3, 223; CHECK-LNX-NEXT: xvcvsxwdp 3, 3424; CHECK-LNX-NEXT: xsaddsp 2, 2, 325; CHECK-LNX-NEXT: xsmulsp 2, 4, 226; CHECK-LNX-NEXT: lfs 4, .LCPI0_1@toc@l(3)27; CHECK-LNX-NEXT: xssubsp 1, 1, 428; CHECK-LNX-NEXT: fsel 1, 1, 2, 529; CHECK-LNX-NEXT: xsrsqrtesp 2, 130; CHECK-LNX-NEXT: xsmulsp 6, 1, 231; CHECK-LNX-NEXT: xsabsdp 1, 132; CHECK-LNX-NEXT: xsmulsp 2, 6, 233; CHECK-LNX-NEXT: xsmulsp 0, 6, 034; CHECK-LNX-NEXT: xssubsp 1, 1, 435; CHECK-LNX-NEXT: xsaddsp 2, 2, 336; CHECK-LNX-NEXT: xsmulsp 0, 0, 237; CHECK-LNX-NEXT: fsel 1, 1, 0, 538; CHECK-LNX-NEXT: blr39;40; CHECK-AIX-LABEL: llvmintr_powf_f32_fast025:41; CHECK-AIX: # %bb.0: # %entry42; CHECK-AIX-NEXT: mflr 043; CHECK-AIX-NEXT: stwu 1, -64(1)44; CHECK-AIX-NEXT: lwz 3, L..C0(2) # %const.045; CHECK-AIX-NEXT: stw 0, 72(1)46; CHECK-AIX-NEXT: lfs 2, 0(3)47; CHECK-AIX-NEXT: bl .__xl_powf_finite[PR]48; CHECK-AIX-NEXT: nop49; CHECK-AIX-NEXT: addi 1, 1, 6450; CHECK-AIX-NEXT: lwz 0, 8(1)51; CHECK-AIX-NEXT: mtlr 052; CHECK-AIX-NEXT: blr53entry:54 %call = tail call nnan ninf afn nsz float @llvm.pow.f32(float %a, float 2.500000e-01)55 ret float %call56}57 58; fast-math pow with 0.2559; TODO: pow->sqrt conversion for AIX60define double @llvmintr_pow_f64_fast025(double %a) #1 {61; CHECK-LNX-LABEL: llvmintr_pow_f64_fast025:62; CHECK-LNX: # %bb.0: # %entry63; CHECK-LNX-NEXT: xstsqrtdp 0, 164; CHECK-LNX-NEXT: vspltisw 2, -365; CHECK-LNX-NEXT: addis 3, 2, .LCPI1_0@toc@ha66; CHECK-LNX-NEXT: xvcvsxwdp 2, 3467; CHECK-LNX-NEXT: lfs 0, .LCPI1_0@toc@l(3)68; CHECK-LNX-NEXT: bc 12, 2, .LBB1_369; CHECK-LNX-NEXT: # %bb.1: # %entry70; CHECK-LNX-NEXT: xsrsqrtedp 3, 171; CHECK-LNX-NEXT: xsmuldp 5, 1, 372; CHECK-LNX-NEXT: xsmuldp 4, 3, 073; CHECK-LNX-NEXT: xsmuldp 3, 5, 374; CHECK-LNX-NEXT: xsadddp 3, 3, 275; CHECK-LNX-NEXT: xsmuldp 3, 4, 376; CHECK-LNX-NEXT: xsmuldp 1, 1, 377; CHECK-LNX-NEXT: xsmuldp 3, 1, 378; CHECK-LNX-NEXT: xsmuldp 1, 1, 079; CHECK-LNX-NEXT: xsadddp 3, 3, 280; CHECK-LNX-NEXT: xsmuldp 1, 1, 381; CHECK-LNX-NEXT: xstsqrtdp 0, 182; CHECK-LNX-NEXT: bc 4, 2, .LBB1_483; CHECK-LNX-NEXT: .LBB1_2:84; CHECK-LNX-NEXT: xssqrtdp 1, 185; CHECK-LNX-NEXT: blr86; CHECK-LNX-NEXT: .LBB1_3:87; CHECK-LNX-NEXT: xssqrtdp 1, 188; CHECK-LNX-NEXT: xstsqrtdp 0, 189; CHECK-LNX-NEXT: bc 12, 2, .LBB1_290; CHECK-LNX-NEXT: .LBB1_4: # %entry91; CHECK-LNX-NEXT: xsrsqrtedp 3, 192; CHECK-LNX-NEXT: xsmuldp 4, 1, 393; CHECK-LNX-NEXT: xsmuldp 4, 4, 394; CHECK-LNX-NEXT: xsmuldp 3, 3, 095; CHECK-LNX-NEXT: xsadddp 4, 4, 296; CHECK-LNX-NEXT: xsmuldp 3, 3, 497; CHECK-LNX-NEXT: xsmuldp 1, 1, 398; CHECK-LNX-NEXT: xsmuldp 3, 1, 399; CHECK-LNX-NEXT: xsmuldp 0, 1, 0100; CHECK-LNX-NEXT: xsadddp 2, 3, 2101; CHECK-LNX-NEXT: xsmuldp 1, 0, 2102; CHECK-LNX-NEXT: blr103;104; CHECK-AIX-LABEL: llvmintr_pow_f64_fast025:105; CHECK-AIX: # %bb.0: # %entry106; CHECK-AIX-NEXT: mflr 0107; CHECK-AIX-NEXT: stwu 1, -64(1)108; CHECK-AIX-NEXT: lwz 3, L..C1(2) # %const.0109; CHECK-AIX-NEXT: stw 0, 72(1)110; CHECK-AIX-NEXT: lfs 2, 0(3)111; CHECK-AIX-NEXT: bl .__xl_pow_finite[PR]112; CHECK-AIX-NEXT: nop113; CHECK-AIX-NEXT: addi 1, 1, 64114; CHECK-AIX-NEXT: lwz 0, 8(1)115; CHECK-AIX-NEXT: mtlr 0116; CHECK-AIX-NEXT: blr117entry:118 %call = tail call nnan ninf afn nsz double @llvm.pow.f64(double %a, double 2.500000e-01)119 ret double %call120}121 122; fast-math powf with 0.75123; TODO: pow->sqrt conversion for AIX124define float @llvmintr_powf_f32_fast075(float %a) #1 {125; CHECK-LNX-LABEL: llvmintr_powf_f32_fast075:126; CHECK-LNX: # %bb.0: # %entry127; CHECK-LNX-NEXT: xsrsqrtesp 2, 1128; CHECK-LNX-NEXT: addis 3, 2, .LCPI2_0@toc@ha129; CHECK-LNX-NEXT: vspltisw 2, -3130; CHECK-LNX-NEXT: lfs 0, .LCPI2_0@toc@l(3)131; CHECK-LNX-NEXT: addis 3, 2, .LCPI2_1@toc@ha132; CHECK-LNX-NEXT: xxlxor 5, 5, 5133; CHECK-LNX-NEXT: xsmulsp 3, 1, 2134; CHECK-LNX-NEXT: xsabsdp 1, 1135; CHECK-LNX-NEXT: xsmulsp 4, 3, 0136; CHECK-LNX-NEXT: xsmulsp 2, 3, 2137; CHECK-LNX-NEXT: xvcvsxwdp 3, 34138; CHECK-LNX-NEXT: xsaddsp 2, 2, 3139; CHECK-LNX-NEXT: xsmulsp 2, 4, 2140; CHECK-LNX-NEXT: lfs 4, .LCPI2_1@toc@l(3)141; CHECK-LNX-NEXT: xssubsp 1, 1, 4142; CHECK-LNX-NEXT: fsel 1, 1, 2, 5143; CHECK-LNX-NEXT: xsrsqrtesp 2, 1144; CHECK-LNX-NEXT: xsmulsp 6, 1, 2145; CHECK-LNX-NEXT: xsmulsp 2, 6, 2146; CHECK-LNX-NEXT: xsmulsp 0, 6, 0147; CHECK-LNX-NEXT: xsaddsp 2, 2, 3148; CHECK-LNX-NEXT: xsmulsp 0, 0, 2149; CHECK-LNX-NEXT: xsabsdp 2, 1150; CHECK-LNX-NEXT: xssubsp 2, 2, 4151; CHECK-LNX-NEXT: fsel 0, 2, 0, 5152; CHECK-LNX-NEXT: xsmulsp 1, 1, 0153; CHECK-LNX-NEXT: blr154;155; CHECK-AIX-LABEL: llvmintr_powf_f32_fast075:156; CHECK-AIX: # %bb.0: # %entry157; CHECK-AIX-NEXT: mflr 0158; CHECK-AIX-NEXT: stwu 1, -64(1)159; CHECK-AIX-NEXT: lwz 3, L..C2(2) # %const.0160; CHECK-AIX-NEXT: stw 0, 72(1)161; CHECK-AIX-NEXT: lfs 2, 0(3)162; CHECK-AIX-NEXT: bl .__xl_powf_finite[PR]163; CHECK-AIX-NEXT: nop164; CHECK-AIX-NEXT: addi 1, 1, 64165; CHECK-AIX-NEXT: lwz 0, 8(1)166; CHECK-AIX-NEXT: mtlr 0167; CHECK-AIX-NEXT: blr168entry:169 %call = tail call nnan ninf afn nsz float @llvm.pow.f32(float %a, float 7.500000e-01)170 ret float %call171}172 173; fast-math pow with 0.75174; TODO: pow->sqrt conversion for AIX175define double @llvmintr_pow_f64_fast075(double %a) #1 {176; CHECK-LNX-LABEL: llvmintr_pow_f64_fast075:177; CHECK-LNX: # %bb.0: # %entry178; CHECK-LNX-NEXT: xstsqrtdp 0, 1179; CHECK-LNX-NEXT: vspltisw 2, -3180; CHECK-LNX-NEXT: addis 3, 2, .LCPI3_0@toc@ha181; CHECK-LNX-NEXT: xvcvsxwdp 2, 34182; CHECK-LNX-NEXT: lfs 0, .LCPI3_0@toc@l(3)183; CHECK-LNX-NEXT: bc 12, 2, .LBB3_3184; CHECK-LNX-NEXT: # %bb.1: # %entry185; CHECK-LNX-NEXT: xsrsqrtedp 3, 1186; CHECK-LNX-NEXT: xsmuldp 5, 1, 3187; CHECK-LNX-NEXT: xsmuldp 4, 3, 0188; CHECK-LNX-NEXT: xsmuldp 3, 5, 3189; CHECK-LNX-NEXT: xsadddp 3, 3, 2190; CHECK-LNX-NEXT: xsmuldp 3, 4, 3191; CHECK-LNX-NEXT: xsmuldp 1, 1, 3192; CHECK-LNX-NEXT: xsmuldp 3, 1, 3193; CHECK-LNX-NEXT: xsmuldp 1, 1, 0194; CHECK-LNX-NEXT: xsadddp 3, 3, 2195; CHECK-LNX-NEXT: xsmuldp 1, 1, 3196; CHECK-LNX-NEXT: xstsqrtdp 0, 1197; CHECK-LNX-NEXT: bc 4, 2, .LBB3_4198; CHECK-LNX-NEXT: .LBB3_2:199; CHECK-LNX-NEXT: xssqrtdp 0, 1200; CHECK-LNX-NEXT: xsmuldp 1, 1, 0201; CHECK-LNX-NEXT: blr202; CHECK-LNX-NEXT: .LBB3_3:203; CHECK-LNX-NEXT: xssqrtdp 1, 1204; CHECK-LNX-NEXT: xstsqrtdp 0, 1205; CHECK-LNX-NEXT: bc 12, 2, .LBB3_2206; CHECK-LNX-NEXT: .LBB3_4: # %entry207; CHECK-LNX-NEXT: xsrsqrtedp 3, 1208; CHECK-LNX-NEXT: xsmuldp 4, 1, 3209; CHECK-LNX-NEXT: xsmuldp 4, 4, 3210; CHECK-LNX-NEXT: xsmuldp 3, 3, 0211; CHECK-LNX-NEXT: xsadddp 4, 4, 2212; CHECK-LNX-NEXT: xsmuldp 3, 3, 4213; CHECK-LNX-NEXT: xsmuldp 4, 1, 3214; CHECK-LNX-NEXT: xsmuldp 3, 4, 3215; CHECK-LNX-NEXT: xsmuldp 0, 4, 0216; CHECK-LNX-NEXT: xsadddp 2, 3, 2217; CHECK-LNX-NEXT: xsmuldp 0, 0, 2218; CHECK-LNX-NEXT: xsmuldp 1, 1, 0219; CHECK-LNX-NEXT: blr220;221; CHECK-AIX-LABEL: llvmintr_pow_f64_fast075:222; CHECK-AIX: # %bb.0: # %entry223; CHECK-AIX-NEXT: mflr 0224; CHECK-AIX-NEXT: stwu 1, -64(1)225; CHECK-AIX-NEXT: lwz 3, L..C3(2) # %const.0226; CHECK-AIX-NEXT: stw 0, 72(1)227; CHECK-AIX-NEXT: lfs 2, 0(3)228; CHECK-AIX-NEXT: bl .__xl_pow_finite[PR]229; CHECK-AIX-NEXT: nop230; CHECK-AIX-NEXT: addi 1, 1, 64231; CHECK-AIX-NEXT: lwz 0, 8(1)232; CHECK-AIX-NEXT: mtlr 0233; CHECK-AIX-NEXT: blr234entry:235 %call = tail call nnan ninf afn nsz double @llvm.pow.f64(double %a, double 7.500000e-01)236 ret double %call237}238 239; fast-math powf with 0.50240; TODO: pow->sqrt conversion for LinuxLE and AIX241define float @llvmintr_powf_f32_fast050(float %a) #1 {242; CHECK-LNX-LABEL: llvmintr_powf_f32_fast050:243; CHECK-LNX: # %bb.0: # %entry244; CHECK-LNX-NEXT: mflr 0245; CHECK-LNX-NEXT: stdu 1, -32(1)246; CHECK-LNX-NEXT: std 0, 48(1)247; CHECK-LNX-NEXT: .cfi_def_cfa_offset 32248; CHECK-LNX-NEXT: .cfi_offset lr, 16249; CHECK-LNX-NEXT: addis 3, 2, .LCPI4_0@toc@ha250; CHECK-LNX-NEXT: lfs 2, .LCPI4_0@toc@l(3)251; CHECK-LNX-NEXT: bl __xl_powf_finite252; CHECK-LNX-NEXT: nop253; CHECK-LNX-NEXT: addi 1, 1, 32254; CHECK-LNX-NEXT: ld 0, 16(1)255; CHECK-LNX-NEXT: mtlr 0256; CHECK-LNX-NEXT: blr257;258; CHECK-AIX-LABEL: llvmintr_powf_f32_fast050:259; CHECK-AIX: # %bb.0: # %entry260; CHECK-AIX-NEXT: mflr 0261; CHECK-AIX-NEXT: stwu 1, -64(1)262; CHECK-AIX-NEXT: lwz 3, L..C4(2) # %const.0263; CHECK-AIX-NEXT: stw 0, 72(1)264; CHECK-AIX-NEXT: lfs 2, 0(3)265; CHECK-AIX-NEXT: bl .__xl_powf_finite[PR]266; CHECK-AIX-NEXT: nop267; CHECK-AIX-NEXT: addi 1, 1, 64268; CHECK-AIX-NEXT: lwz 0, 8(1)269; CHECK-AIX-NEXT: mtlr 0270; CHECK-AIX-NEXT: blr271entry:272 %call = tail call nnan ninf afn nsz float @llvm.pow.f32(float %a, float 5.000000e-01)273 ret float %call274}275 276; fast-math pow with 0.50277; TODO: pow->sqrt conversion for LinuxLE and AIX278define double @llvmintr_pow_f64_fast050(double %a) #1 {279; CHECK-LNX-LABEL: llvmintr_pow_f64_fast050:280; CHECK-LNX: # %bb.0: # %entry281; CHECK-LNX-NEXT: mflr 0282; CHECK-LNX-NEXT: stdu 1, -32(1)283; CHECK-LNX-NEXT: std 0, 48(1)284; CHECK-LNX-NEXT: .cfi_def_cfa_offset 32285; CHECK-LNX-NEXT: .cfi_offset lr, 16286; CHECK-LNX-NEXT: addis 3, 2, .LCPI5_0@toc@ha287; CHECK-LNX-NEXT: lfs 2, .LCPI5_0@toc@l(3)288; CHECK-LNX-NEXT: bl __xl_pow_finite289; CHECK-LNX-NEXT: nop290; CHECK-LNX-NEXT: addi 1, 1, 32291; CHECK-LNX-NEXT: ld 0, 16(1)292; CHECK-LNX-NEXT: mtlr 0293; CHECK-LNX-NEXT: blr294;295; CHECK-AIX-LABEL: llvmintr_pow_f64_fast050:296; CHECK-AIX: # %bb.0: # %entry297; CHECK-AIX-NEXT: mflr 0298; CHECK-AIX-NEXT: stwu 1, -64(1)299; CHECK-AIX-NEXT: lwz 3, L..C5(2) # %const.0300; CHECK-AIX-NEXT: stw 0, 72(1)301; CHECK-AIX-NEXT: lfs 2, 0(3)302; CHECK-AIX-NEXT: bl .__xl_pow_finite[PR]303; CHECK-AIX-NEXT: nop304; CHECK-AIX-NEXT: addi 1, 1, 64305; CHECK-AIX-NEXT: lwz 0, 8(1)306; CHECK-AIX-NEXT: mtlr 0307; CHECK-AIX-NEXT: blr308entry:309 %call = tail call nnan ninf afn nsz double @llvm.pow.f64(double %a, double 5.000000e-01)310 ret double %call311}312attributes #1 = { "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" }313