5724 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 22; RUN: llc -global-isel=0 -mtriple=amdgcn -mcpu=tahiti < %s | FileCheck -check-prefixes=GCN,SDAG,SI-SDAG %s3; RUN: llc -global-isel=1 -mtriple=amdgcn -mcpu=tahiti < %s | FileCheck -check-prefixes=GCN,GISEL,SI-GISEL %s4 5; RUN: llc -global-isel=0 -mtriple=amdgcn -mcpu=fiji < %s | FileCheck -check-prefixes=GCN,SDAG,VI-SDAG %s6; RUN: llc -global-isel=1 -mtriple=amdgcn -mcpu=fiji < %s | FileCheck -check-prefixes=GCN,GISEL,VI-GISEL %s7 8declare i32 @llvm.amdgcn.workitem.id.x()9declare i32 @llvm.amdgcn.readfirstlane(i32)10declare double @llvm.sqrt.f64(double)11declare <2 x double> @llvm.sqrt.v2f64(<2 x double>)12declare double @llvm.amdgcn.sqrt.f64(double)13declare double @llvm.fabs.f64(double)14 15define amdgpu_ps <2 x i32> @s_rsq_f64(double inreg %x) {16; SI-SDAG-LABEL: s_rsq_f64:17; SI-SDAG: ; %bb.0:18; SI-SDAG-NEXT: v_mov_b32_e32 v0, 019; SI-SDAG-NEXT: v_bfrev_b32_e32 v1, 820; SI-SDAG-NEXT: v_cmp_lt_f64_e32 vcc, s[0:1], v[0:1]21; SI-SDAG-NEXT: v_mov_b32_e32 v8, 0x26022; SI-SDAG-NEXT: s_and_b64 s[2:3], vcc, exec23; SI-SDAG-NEXT: s_cselect_b32 s2, 0x100, 024; SI-SDAG-NEXT: v_mov_b32_e32 v0, s225; SI-SDAG-NEXT: v_ldexp_f64 v[0:1], s[0:1], v026; SI-SDAG-NEXT: s_cselect_b32 s0, 0xffffff80, 027; SI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]28; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v829; SI-SDAG-NEXT: s_mov_b32 s2, 0x3ff0000030; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]31; SI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.532; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.533; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]34; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]35; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]36; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]37; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]38; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]39; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], s040; SI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc41; SI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc42; SI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[0:1], v[0:1], v[0:1], 1.043; SI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]44; SI-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, v1, v345; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.046; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]47; SI-SDAG-NEXT: v_div_scale_f64 v[6:7], s[0:1], 1.0, v[0:1], 1.048; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.049; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]50; SI-SDAG-NEXT: v_cmp_eq_u32_e64 s[0:1], s2, v751; SI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]52; SI-SDAG-NEXT: s_xor_b64 vcc, s[0:1], vcc53; SI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]54; SI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]55; SI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.056; SI-SDAG-NEXT: v_readfirstlane_b32 s0, v057; SI-SDAG-NEXT: v_readfirstlane_b32 s1, v158; SI-SDAG-NEXT: ; return to shader part epilog59;60; SI-GISEL-LABEL: s_rsq_f64:61; SI-GISEL: ; %bb.0:62; SI-GISEL-NEXT: v_mov_b32_e32 v0, 063; SI-GISEL-NEXT: v_bfrev_b32_e32 v1, 864; SI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, s[0:1], v[0:1]65; SI-GISEL-NEXT: v_mov_b32_e32 v8, 0xffffff8066; SI-GISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc67; SI-GISEL-NEXT: v_lshlrev_b32_e32 v0, 8, v068; SI-GISEL-NEXT: v_ldexp_f64 v[0:1], s[0:1], v069; SI-GISEL-NEXT: v_mov_b32_e32 v9, 0x26070; SI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]71; SI-GISEL-NEXT: v_mov_b32_e32 v10, 0x3ff0000072; SI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.573; SI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]74; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.575; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]76; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]77; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]78; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]79; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]80; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]81; SI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc82; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v483; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v984; SI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc85; SI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc86; SI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[0:1], v[0:1], v[0:1], 1.087; SI-GISEL-NEXT: v_div_scale_f64 v[8:9], s[0:1], 1.0, v[0:1], 1.088; SI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]89; SI-GISEL-NEXT: v_cmp_eq_u32_e64 s[0:1], v1, v390; SI-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v9, v1091; SI-GISEL-NEXT: s_xor_b64 vcc, vcc, s[0:1]92; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.093; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]94; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.095; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]96; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[8:9], v[4:5]97; SI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[6:7], v[8:9]98; SI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[6:7]99; SI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.0100; SI-GISEL-NEXT: v_readfirstlane_b32 s0, v0101; SI-GISEL-NEXT: v_readfirstlane_b32 s1, v1102; SI-GISEL-NEXT: ; return to shader part epilog103;104; VI-SDAG-LABEL: s_rsq_f64:105; VI-SDAG: ; %bb.0:106; VI-SDAG-NEXT: v_mov_b32_e32 v0, 0107; VI-SDAG-NEXT: v_bfrev_b32_e32 v1, 8108; VI-SDAG-NEXT: v_cmp_lt_f64_e32 vcc, s[0:1], v[0:1]109; VI-SDAG-NEXT: s_and_b64 s[2:3], vcc, exec110; VI-SDAG-NEXT: s_cselect_b32 s2, 0x100, 0111; VI-SDAG-NEXT: v_mov_b32_e32 v0, s2112; VI-SDAG-NEXT: v_ldexp_f64 v[0:1], s[0:1], v0113; VI-SDAG-NEXT: s_cselect_b32 s0, 0xffffff80, 0114; VI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]115; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]116; VI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.5117; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.5118; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]119; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]120; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]121; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]122; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]123; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]124; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0x260125; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v4126; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], s0127; VI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc128; VI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc129; VI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[0:1], v[0:1], v[0:1], 1.0130; VI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]131; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0132; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]133; VI-SDAG-NEXT: v_div_scale_f64 v[6:7], vcc, 1.0, v[0:1], 1.0134; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.0135; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]136; VI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]137; VI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]138; VI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]139; VI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.0140; VI-SDAG-NEXT: v_readfirstlane_b32 s0, v0141; VI-SDAG-NEXT: v_readfirstlane_b32 s1, v1142; VI-SDAG-NEXT: ; return to shader part epilog143;144; VI-GISEL-LABEL: s_rsq_f64:145; VI-GISEL: ; %bb.0:146; VI-GISEL-NEXT: v_mov_b32_e32 v0, 0147; VI-GISEL-NEXT: v_bfrev_b32_e32 v1, 8148; VI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, s[0:1], v[0:1]149; VI-GISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc150; VI-GISEL-NEXT: v_lshlrev_b32_e32 v0, 8, v0151; VI-GISEL-NEXT: v_ldexp_f64 v[0:1], s[0:1], v0152; VI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]153; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.5154; VI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]155; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.5156; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]157; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]158; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]159; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]160; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]161; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]162; VI-GISEL-NEXT: v_mov_b32_e32 v4, 0xffffff80163; VI-GISEL-NEXT: v_mov_b32_e32 v5, 0x260164; VI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc165; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v5166; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v4167; VI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc168; VI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc169; VI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[0:1], v[0:1], v[0:1], 1.0170; VI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]171; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0172; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]173; VI-GISEL-NEXT: v_div_scale_f64 v[6:7], vcc, 1.0, v[0:1], 1.0174; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.0175; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]176; VI-GISEL-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]177; VI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]178; VI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]179; VI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.0180; VI-GISEL-NEXT: v_readfirstlane_b32 s0, v0181; VI-GISEL-NEXT: v_readfirstlane_b32 s1, v1182; VI-GISEL-NEXT: ; return to shader part epilog183 %rsq = call contract double @llvm.sqrt.f64(double %x)184 %result = fdiv contract double 1.0, %rsq185 %cast = bitcast double %result to <2 x i32>186 %cast.0 = extractelement <2 x i32> %cast, i32 0187 %cast.1 = extractelement <2 x i32> %cast, i32 1188 %lane.0 = call i32 @llvm.amdgcn.readfirstlane(i32 %cast.0)189 %lane.1 = call i32 @llvm.amdgcn.readfirstlane(i32 %cast.1)190 %insert.0 = insertelement <2 x i32> poison, i32 %lane.0, i32 0191 %insert.1 = insertelement <2 x i32> %insert.0, i32 %lane.1, i32 1192 ret <2 x i32> %insert.1193}194 195define amdgpu_ps <2 x i32> @s_rsq_f64_fabs(double inreg %x) {196; SI-SDAG-LABEL: s_rsq_f64_fabs:197; SI-SDAG: ; %bb.0:198; SI-SDAG-NEXT: v_mov_b32_e32 v0, 0199; SI-SDAG-NEXT: v_bfrev_b32_e32 v1, 8200; SI-SDAG-NEXT: v_cmp_lt_f64_e64 s[2:3], |s[0:1]|, v[0:1]201; SI-SDAG-NEXT: v_mov_b32_e32 v8, 0x260202; SI-SDAG-NEXT: s_and_b64 s[2:3], s[2:3], exec203; SI-SDAG-NEXT: s_cselect_b32 s2, 0x100, 0204; SI-SDAG-NEXT: v_mov_b32_e32 v0, s2205; SI-SDAG-NEXT: v_ldexp_f64 v[0:1], |s[0:1]|, v0206; SI-SDAG-NEXT: s_cselect_b32 s0, 0xffffff80, 0207; SI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]208; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v8209; SI-SDAG-NEXT: s_mov_b32 s2, 0x3ff00000210; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]211; SI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.5212; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.5213; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]214; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]215; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]216; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]217; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]218; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]219; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], s0220; SI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc221; SI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc222; SI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[0:1], v[0:1], v[0:1], 1.0223; SI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]224; SI-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, v1, v3225; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0226; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]227; SI-SDAG-NEXT: v_div_scale_f64 v[6:7], s[0:1], 1.0, v[0:1], 1.0228; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.0229; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]230; SI-SDAG-NEXT: v_cmp_eq_u32_e64 s[0:1], s2, v7231; SI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]232; SI-SDAG-NEXT: s_xor_b64 vcc, s[0:1], vcc233; SI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]234; SI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]235; SI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.0236; SI-SDAG-NEXT: v_readfirstlane_b32 s0, v0237; SI-SDAG-NEXT: v_readfirstlane_b32 s1, v1238; SI-SDAG-NEXT: ; return to shader part epilog239;240; SI-GISEL-LABEL: s_rsq_f64_fabs:241; SI-GISEL: ; %bb.0:242; SI-GISEL-NEXT: v_mov_b32_e32 v0, 0243; SI-GISEL-NEXT: v_bfrev_b32_e32 v1, 8244; SI-GISEL-NEXT: v_cmp_lt_f64_e64 vcc, |s[0:1]|, v[0:1]245; SI-GISEL-NEXT: v_mov_b32_e32 v8, 0xffffff80246; SI-GISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc247; SI-GISEL-NEXT: v_lshlrev_b32_e32 v0, 8, v0248; SI-GISEL-NEXT: v_ldexp_f64 v[0:1], |s[0:1]|, v0249; SI-GISEL-NEXT: v_mov_b32_e32 v9, 0x260250; SI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]251; SI-GISEL-NEXT: v_mov_b32_e32 v10, 0x3ff00000252; SI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.5253; SI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]254; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.5255; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]256; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]257; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]258; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]259; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]260; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]261; SI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc262; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v4263; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v9264; SI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc265; SI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc266; SI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[0:1], v[0:1], v[0:1], 1.0267; SI-GISEL-NEXT: v_div_scale_f64 v[8:9], s[0:1], 1.0, v[0:1], 1.0268; SI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]269; SI-GISEL-NEXT: v_cmp_eq_u32_e64 s[0:1], v1, v3270; SI-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v9, v10271; SI-GISEL-NEXT: s_xor_b64 vcc, vcc, s[0:1]272; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0273; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]274; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0275; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]276; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[8:9], v[4:5]277; SI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[6:7], v[8:9]278; SI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[6:7]279; SI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.0280; SI-GISEL-NEXT: v_readfirstlane_b32 s0, v0281; SI-GISEL-NEXT: v_readfirstlane_b32 s1, v1282; SI-GISEL-NEXT: ; return to shader part epilog283;284; VI-SDAG-LABEL: s_rsq_f64_fabs:285; VI-SDAG: ; %bb.0:286; VI-SDAG-NEXT: v_mov_b32_e32 v0, 0287; VI-SDAG-NEXT: v_bfrev_b32_e32 v1, 8288; VI-SDAG-NEXT: v_cmp_lt_f64_e64 s[2:3], |s[0:1]|, v[0:1]289; VI-SDAG-NEXT: s_and_b64 s[2:3], s[2:3], exec290; VI-SDAG-NEXT: s_cselect_b32 s2, 0x100, 0291; VI-SDAG-NEXT: v_mov_b32_e32 v0, s2292; VI-SDAG-NEXT: v_ldexp_f64 v[0:1], |s[0:1]|, v0293; VI-SDAG-NEXT: s_cselect_b32 s0, 0xffffff80, 0294; VI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]295; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]296; VI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.5297; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.5298; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]299; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]300; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]301; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]302; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]303; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]304; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0x260305; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v4306; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], s0307; VI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc308; VI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc309; VI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[0:1], v[0:1], v[0:1], 1.0310; VI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]311; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0312; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]313; VI-SDAG-NEXT: v_div_scale_f64 v[6:7], vcc, 1.0, v[0:1], 1.0314; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.0315; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]316; VI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]317; VI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]318; VI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]319; VI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.0320; VI-SDAG-NEXT: v_readfirstlane_b32 s0, v0321; VI-SDAG-NEXT: v_readfirstlane_b32 s1, v1322; VI-SDAG-NEXT: ; return to shader part epilog323;324; VI-GISEL-LABEL: s_rsq_f64_fabs:325; VI-GISEL: ; %bb.0:326; VI-GISEL-NEXT: v_mov_b32_e32 v0, 0327; VI-GISEL-NEXT: v_bfrev_b32_e32 v1, 8328; VI-GISEL-NEXT: v_cmp_lt_f64_e64 vcc, |s[0:1]|, v[0:1]329; VI-GISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc330; VI-GISEL-NEXT: v_lshlrev_b32_e32 v0, 8, v0331; VI-GISEL-NEXT: v_ldexp_f64 v[0:1], |s[0:1]|, v0332; VI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]333; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.5334; VI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]335; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.5336; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]337; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]338; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]339; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]340; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]341; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]342; VI-GISEL-NEXT: v_mov_b32_e32 v4, 0xffffff80343; VI-GISEL-NEXT: v_mov_b32_e32 v5, 0x260344; VI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc345; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v5346; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v4347; VI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc348; VI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc349; VI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[0:1], v[0:1], v[0:1], 1.0350; VI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]351; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0352; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]353; VI-GISEL-NEXT: v_div_scale_f64 v[6:7], vcc, 1.0, v[0:1], 1.0354; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.0355; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]356; VI-GISEL-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]357; VI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]358; VI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]359; VI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.0360; VI-GISEL-NEXT: v_readfirstlane_b32 s0, v0361; VI-GISEL-NEXT: v_readfirstlane_b32 s1, v1362; VI-GISEL-NEXT: ; return to shader part epilog363 %fabs.x = call double @llvm.fabs.f64(double %x)364 %rsq = call contract double @llvm.sqrt.f64(double %fabs.x)365 %result = fdiv contract double 1.0, %rsq366 %cast = bitcast double %result to <2 x i32>367 %cast.0 = extractelement <2 x i32> %cast, i32 0368 %cast.1 = extractelement <2 x i32> %cast, i32 1369 %lane.0 = call i32 @llvm.amdgcn.readfirstlane(i32 %cast.0)370 %lane.1 = call i32 @llvm.amdgcn.readfirstlane(i32 %cast.1)371 %insert.0 = insertelement <2 x i32> poison, i32 %lane.0, i32 0372 %insert.1 = insertelement <2 x i32> %insert.0, i32 %lane.1, i32 1373 ret <2 x i32> %insert.1374}375 376define amdgpu_ps <2 x i32> @s_neg_rsq_f64(double inreg %x) {377; SI-SDAG-LABEL: s_neg_rsq_f64:378; SI-SDAG: ; %bb.0:379; SI-SDAG-NEXT: v_mov_b32_e32 v0, 0380; SI-SDAG-NEXT: v_bfrev_b32_e32 v1, 8381; SI-SDAG-NEXT: v_cmp_lt_f64_e32 vcc, s[0:1], v[0:1]382; SI-SDAG-NEXT: v_mov_b32_e32 v8, 0x260383; SI-SDAG-NEXT: s_and_b64 s[2:3], vcc, exec384; SI-SDAG-NEXT: s_cselect_b32 s2, 0x100, 0385; SI-SDAG-NEXT: v_mov_b32_e32 v0, s2386; SI-SDAG-NEXT: v_ldexp_f64 v[0:1], s[0:1], v0387; SI-SDAG-NEXT: s_cselect_b32 s0, 0xffffff80, 0388; SI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]389; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v8390; SI-SDAG-NEXT: s_mov_b32 s2, 0xbff00000391; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]392; SI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.5393; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.5394; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]395; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]396; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]397; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]398; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]399; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]400; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], s0401; SI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc402; SI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc403; SI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[0:1], v[0:1], v[0:1], -1.0404; SI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]405; SI-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, v1, v3406; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0407; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]408; SI-SDAG-NEXT: v_div_scale_f64 v[6:7], s[0:1], -1.0, v[0:1], -1.0409; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.0410; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]411; SI-SDAG-NEXT: v_cmp_eq_u32_e64 s[0:1], s2, v7412; SI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]413; SI-SDAG-NEXT: s_xor_b64 vcc, s[0:1], vcc414; SI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]415; SI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]416; SI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], -1.0417; SI-SDAG-NEXT: v_readfirstlane_b32 s0, v0418; SI-SDAG-NEXT: v_readfirstlane_b32 s1, v1419; SI-SDAG-NEXT: ; return to shader part epilog420;421; SI-GISEL-LABEL: s_neg_rsq_f64:422; SI-GISEL: ; %bb.0:423; SI-GISEL-NEXT: v_mov_b32_e32 v0, 0424; SI-GISEL-NEXT: v_bfrev_b32_e32 v1, 8425; SI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, s[0:1], v[0:1]426; SI-GISEL-NEXT: v_mov_b32_e32 v8, 0xffffff80427; SI-GISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc428; SI-GISEL-NEXT: v_lshlrev_b32_e32 v0, 8, v0429; SI-GISEL-NEXT: v_ldexp_f64 v[0:1], s[0:1], v0430; SI-GISEL-NEXT: v_mov_b32_e32 v9, 0x260431; SI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]432; SI-GISEL-NEXT: v_mov_b32_e32 v10, 0xbff00000433; SI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.5434; SI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]435; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.5436; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]437; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]438; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]439; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]440; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]441; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]442; SI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc443; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v4444; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v9445; SI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc446; SI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc447; SI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[0:1], v[0:1], v[0:1], -1.0448; SI-GISEL-NEXT: v_div_scale_f64 v[8:9], s[0:1], -1.0, v[0:1], -1.0449; SI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]450; SI-GISEL-NEXT: v_cmp_eq_u32_e64 s[0:1], v1, v3451; SI-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v9, v10452; SI-GISEL-NEXT: s_xor_b64 vcc, vcc, s[0:1]453; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0454; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]455; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0456; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]457; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[8:9], v[4:5]458; SI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[6:7], v[8:9]459; SI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[6:7]460; SI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], -1.0461; SI-GISEL-NEXT: v_readfirstlane_b32 s0, v0462; SI-GISEL-NEXT: v_readfirstlane_b32 s1, v1463; SI-GISEL-NEXT: ; return to shader part epilog464;465; VI-SDAG-LABEL: s_neg_rsq_f64:466; VI-SDAG: ; %bb.0:467; VI-SDAG-NEXT: v_mov_b32_e32 v0, 0468; VI-SDAG-NEXT: v_bfrev_b32_e32 v1, 8469; VI-SDAG-NEXT: v_cmp_lt_f64_e32 vcc, s[0:1], v[0:1]470; VI-SDAG-NEXT: s_and_b64 s[2:3], vcc, exec471; VI-SDAG-NEXT: s_cselect_b32 s2, 0x100, 0472; VI-SDAG-NEXT: v_mov_b32_e32 v0, s2473; VI-SDAG-NEXT: v_ldexp_f64 v[0:1], s[0:1], v0474; VI-SDAG-NEXT: s_cselect_b32 s0, 0xffffff80, 0475; VI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]476; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]477; VI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.5478; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.5479; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]480; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]481; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]482; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]483; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]484; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]485; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0x260486; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v4487; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], s0488; VI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc489; VI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc490; VI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[0:1], v[0:1], v[0:1], -1.0491; VI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]492; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0493; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]494; VI-SDAG-NEXT: v_div_scale_f64 v[6:7], vcc, -1.0, v[0:1], -1.0495; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.0496; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]497; VI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]498; VI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]499; VI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]500; VI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], -1.0501; VI-SDAG-NEXT: v_readfirstlane_b32 s0, v0502; VI-SDAG-NEXT: v_readfirstlane_b32 s1, v1503; VI-SDAG-NEXT: ; return to shader part epilog504;505; VI-GISEL-LABEL: s_neg_rsq_f64:506; VI-GISEL: ; %bb.0:507; VI-GISEL-NEXT: v_mov_b32_e32 v0, 0508; VI-GISEL-NEXT: v_bfrev_b32_e32 v1, 8509; VI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, s[0:1], v[0:1]510; VI-GISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc511; VI-GISEL-NEXT: v_lshlrev_b32_e32 v0, 8, v0512; VI-GISEL-NEXT: v_ldexp_f64 v[0:1], s[0:1], v0513; VI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]514; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.5515; VI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]516; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.5517; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]518; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]519; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]520; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]521; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]522; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]523; VI-GISEL-NEXT: v_mov_b32_e32 v4, 0xffffff80524; VI-GISEL-NEXT: v_mov_b32_e32 v5, 0x260525; VI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc526; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v5527; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v4528; VI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc529; VI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc530; VI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[0:1], v[0:1], v[0:1], -1.0531; VI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]532; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0533; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]534; VI-GISEL-NEXT: v_div_scale_f64 v[6:7], vcc, -1.0, v[0:1], -1.0535; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.0536; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]537; VI-GISEL-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]538; VI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]539; VI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]540; VI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], -1.0541; VI-GISEL-NEXT: v_readfirstlane_b32 s0, v0542; VI-GISEL-NEXT: v_readfirstlane_b32 s1, v1543; VI-GISEL-NEXT: ; return to shader part epilog544 %rsq = call contract double @llvm.sqrt.f64(double %x)545 %result = fdiv contract double -1.0, %rsq546 %cast = bitcast double %result to <2 x i32>547 %cast.0 = extractelement <2 x i32> %cast, i32 0548 %cast.1 = extractelement <2 x i32> %cast, i32 1549 %lane.0 = call i32 @llvm.amdgcn.readfirstlane(i32 %cast.0)550 %lane.1 = call i32 @llvm.amdgcn.readfirstlane(i32 %cast.1)551 %insert.0 = insertelement <2 x i32> poison, i32 %lane.0, i32 0552 %insert.1 = insertelement <2 x i32> %insert.0, i32 %lane.1, i32 1553 ret <2 x i32> %insert.1554}555 556define amdgpu_ps <2 x i32> @s_neg_rsq_neg_f64(double inreg %x) {557; SI-SDAG-LABEL: s_neg_rsq_neg_f64:558; SI-SDAG: ; %bb.0:559; SI-SDAG-NEXT: v_mov_b32_e32 v0, 0560; SI-SDAG-NEXT: v_bfrev_b32_e32 v1, 9561; SI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[0:1], v[0:1]562; SI-SDAG-NEXT: v_mov_b32_e32 v8, 0x260563; SI-SDAG-NEXT: s_and_b64 s[2:3], vcc, exec564; SI-SDAG-NEXT: s_cselect_b32 s2, 0x100, 0565; SI-SDAG-NEXT: v_mov_b32_e32 v0, s2566; SI-SDAG-NEXT: v_ldexp_f64 v[0:1], -s[0:1], v0567; SI-SDAG-NEXT: s_cselect_b32 s0, 0xffffff80, 0568; SI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]569; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v8570; SI-SDAG-NEXT: s_mov_b32 s2, 0xbff00000571; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]572; SI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.5573; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.5574; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]575; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]576; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]577; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]578; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]579; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]580; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], s0581; SI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc582; SI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc583; SI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[0:1], v[0:1], v[0:1], -1.0584; SI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]585; SI-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, v1, v3586; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0587; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]588; SI-SDAG-NEXT: v_div_scale_f64 v[6:7], s[0:1], -1.0, v[0:1], -1.0589; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.0590; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]591; SI-SDAG-NEXT: v_cmp_eq_u32_e64 s[0:1], s2, v7592; SI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]593; SI-SDAG-NEXT: s_xor_b64 vcc, s[0:1], vcc594; SI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]595; SI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]596; SI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], -1.0597; SI-SDAG-NEXT: v_readfirstlane_b32 s0, v0598; SI-SDAG-NEXT: v_readfirstlane_b32 s1, v1599; SI-SDAG-NEXT: ; return to shader part epilog600;601; SI-GISEL-LABEL: s_neg_rsq_neg_f64:602; SI-GISEL: ; %bb.0:603; SI-GISEL-NEXT: v_mov_b32_e32 v0, 0604; SI-GISEL-NEXT: v_bfrev_b32_e32 v1, 8605; SI-GISEL-NEXT: v_cmp_lt_f64_e64 vcc, -s[0:1], v[0:1]606; SI-GISEL-NEXT: v_mov_b32_e32 v8, 0xffffff80607; SI-GISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc608; SI-GISEL-NEXT: v_lshlrev_b32_e32 v0, 8, v0609; SI-GISEL-NEXT: v_ldexp_f64 v[0:1], -s[0:1], v0610; SI-GISEL-NEXT: v_mov_b32_e32 v9, 0x260611; SI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]612; SI-GISEL-NEXT: v_mov_b32_e32 v10, 0xbff00000613; SI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.5614; SI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]615; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.5616; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]617; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]618; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]619; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]620; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]621; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]622; SI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc623; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v4624; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v9625; SI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc626; SI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc627; SI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[0:1], v[0:1], v[0:1], -1.0628; SI-GISEL-NEXT: v_div_scale_f64 v[8:9], s[0:1], -1.0, v[0:1], -1.0629; SI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]630; SI-GISEL-NEXT: v_cmp_eq_u32_e64 s[0:1], v1, v3631; SI-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v9, v10632; SI-GISEL-NEXT: s_xor_b64 vcc, vcc, s[0:1]633; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0634; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]635; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0636; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]637; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[8:9], v[4:5]638; SI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[6:7], v[8:9]639; SI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[6:7]640; SI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], -1.0641; SI-GISEL-NEXT: v_readfirstlane_b32 s0, v0642; SI-GISEL-NEXT: v_readfirstlane_b32 s1, v1643; SI-GISEL-NEXT: ; return to shader part epilog644;645; VI-SDAG-LABEL: s_neg_rsq_neg_f64:646; VI-SDAG: ; %bb.0:647; VI-SDAG-NEXT: v_mov_b32_e32 v0, 0648; VI-SDAG-NEXT: v_bfrev_b32_e32 v1, 9649; VI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[0:1], v[0:1]650; VI-SDAG-NEXT: s_and_b64 s[2:3], vcc, exec651; VI-SDAG-NEXT: s_cselect_b32 s2, 0x100, 0652; VI-SDAG-NEXT: v_mov_b32_e32 v0, s2653; VI-SDAG-NEXT: v_ldexp_f64 v[0:1], -s[0:1], v0654; VI-SDAG-NEXT: s_cselect_b32 s0, 0xffffff80, 0655; VI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]656; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]657; VI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.5658; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.5659; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]660; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]661; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]662; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]663; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]664; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]665; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0x260666; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v4667; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], s0668; VI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc669; VI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc670; VI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[0:1], v[0:1], v[0:1], -1.0671; VI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]672; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0673; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]674; VI-SDAG-NEXT: v_div_scale_f64 v[6:7], vcc, -1.0, v[0:1], -1.0675; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.0676; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]677; VI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]678; VI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]679; VI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]680; VI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], -1.0681; VI-SDAG-NEXT: v_readfirstlane_b32 s0, v0682; VI-SDAG-NEXT: v_readfirstlane_b32 s1, v1683; VI-SDAG-NEXT: ; return to shader part epilog684;685; VI-GISEL-LABEL: s_neg_rsq_neg_f64:686; VI-GISEL: ; %bb.0:687; VI-GISEL-NEXT: v_mov_b32_e32 v0, 0688; VI-GISEL-NEXT: v_bfrev_b32_e32 v1, 8689; VI-GISEL-NEXT: v_cmp_lt_f64_e64 vcc, -s[0:1], v[0:1]690; VI-GISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc691; VI-GISEL-NEXT: v_lshlrev_b32_e32 v0, 8, v0692; VI-GISEL-NEXT: v_ldexp_f64 v[0:1], -s[0:1], v0693; VI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]694; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.5695; VI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]696; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.5697; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]698; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]699; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]700; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]701; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]702; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]703; VI-GISEL-NEXT: v_mov_b32_e32 v4, 0xffffff80704; VI-GISEL-NEXT: v_mov_b32_e32 v5, 0x260705; VI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc706; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v5707; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v4708; VI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc709; VI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc710; VI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[0:1], v[0:1], v[0:1], -1.0711; VI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]712; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0713; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]714; VI-GISEL-NEXT: v_div_scale_f64 v[6:7], vcc, -1.0, v[0:1], -1.0715; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.0716; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]717; VI-GISEL-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]718; VI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]719; VI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]720; VI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], -1.0721; VI-GISEL-NEXT: v_readfirstlane_b32 s0, v0722; VI-GISEL-NEXT: v_readfirstlane_b32 s1, v1723; VI-GISEL-NEXT: ; return to shader part epilog724 %x.neg = fneg double %x725 %rsq = call contract double @llvm.sqrt.f64(double %x.neg)726 %result = fdiv contract double -1.0, %rsq727 %cast = bitcast double %result to <2 x i32>728 %cast.0 = extractelement <2 x i32> %cast, i32 0729 %cast.1 = extractelement <2 x i32> %cast, i32 1730 %lane.0 = call i32 @llvm.amdgcn.readfirstlane(i32 %cast.0)731 %lane.1 = call i32 @llvm.amdgcn.readfirstlane(i32 %cast.1)732 %insert.0 = insertelement <2 x i32> poison, i32 %lane.0, i32 0733 %insert.1 = insertelement <2 x i32> %insert.0, i32 %lane.1, i32 1734 ret <2 x i32> %insert.1735}736 737define double @v_rsq_f64(double %x) {738; SI-SDAG-LABEL: v_rsq_f64:739; SI-SDAG: ; %bb.0:740; SI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)741; SI-SDAG-NEXT: s_mov_b32 s4, 0742; SI-SDAG-NEXT: s_brev_b32 s5, 8743; SI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]744; SI-SDAG-NEXT: v_mov_b32_e32 v2, 0x100745; SI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc746; SI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v2747; SI-SDAG-NEXT: v_mov_b32_e32 v8, 0xffffff80748; SI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]749; SI-SDAG-NEXT: v_mov_b32_e32 v9, 0x260750; SI-SDAG-NEXT: s_mov_b32 s6, 0x3ff00000751; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]752; SI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.5753; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.5754; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]755; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]756; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]757; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]758; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]759; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]760; SI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc761; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v4762; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v9763; SI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc764; SI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc765; SI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.0766; SI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]767; SI-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, v1, v3768; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0769; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]770; SI-SDAG-NEXT: v_div_scale_f64 v[6:7], s[4:5], 1.0, v[0:1], 1.0771; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.0772; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]773; SI-SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], s6, v7774; SI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]775; SI-SDAG-NEXT: s_xor_b64 vcc, s[4:5], vcc776; SI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]777; SI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]778; SI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.0779; SI-SDAG-NEXT: s_setpc_b64 s[30:31]780;781; SI-GISEL-LABEL: v_rsq_f64:782; SI-GISEL: ; %bb.0:783; SI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)784; SI-GISEL-NEXT: v_mov_b32_e32 v2, 0785; SI-GISEL-NEXT: v_bfrev_b32_e32 v3, 8786; SI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]787; SI-GISEL-NEXT: v_mov_b32_e32 v8, 0xffffff80788; SI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc789; SI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v2790; SI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v2791; SI-GISEL-NEXT: v_mov_b32_e32 v9, 0x260792; SI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]793; SI-GISEL-NEXT: v_mov_b32_e32 v10, 0x3ff00000794; SI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.5795; SI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]796; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.5797; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]798; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]799; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]800; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]801; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]802; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]803; SI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc804; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v4805; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v9806; SI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc807; SI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc808; SI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.0809; SI-GISEL-NEXT: v_div_scale_f64 v[8:9], s[4:5], 1.0, v[0:1], 1.0810; SI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]811; SI-GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], v1, v3812; SI-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v9, v10813; SI-GISEL-NEXT: s_xor_b64 vcc, vcc, s[4:5]814; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0815; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]816; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0817; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]818; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[8:9], v[4:5]819; SI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[6:7], v[8:9]820; SI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[6:7]821; SI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.0822; SI-GISEL-NEXT: s_setpc_b64 s[30:31]823;824; VI-SDAG-LABEL: v_rsq_f64:825; VI-SDAG: ; %bb.0:826; VI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)827; VI-SDAG-NEXT: s_mov_b32 s4, 0828; VI-SDAG-NEXT: s_brev_b32 s5, 8829; VI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]830; VI-SDAG-NEXT: v_mov_b32_e32 v2, 0x100831; VI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc832; VI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v2833; VI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]834; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]835; VI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.5836; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.5837; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]838; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]839; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]840; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]841; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]842; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]843; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0xffffff80844; VI-SDAG-NEXT: v_mov_b32_e32 v5, 0x260845; VI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc846; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v5847; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v4848; VI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc849; VI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc850; VI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.0851; VI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]852; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0853; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]854; VI-SDAG-NEXT: v_div_scale_f64 v[6:7], vcc, 1.0, v[0:1], 1.0855; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.0856; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]857; VI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]858; VI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]859; VI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]860; VI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.0861; VI-SDAG-NEXT: s_setpc_b64 s[30:31]862;863; VI-GISEL-LABEL: v_rsq_f64:864; VI-GISEL: ; %bb.0:865; VI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)866; VI-GISEL-NEXT: v_mov_b32_e32 v2, 0867; VI-GISEL-NEXT: v_bfrev_b32_e32 v3, 8868; VI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]869; VI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc870; VI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v2871; VI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v2872; VI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]873; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.5874; VI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]875; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.5876; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]877; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]878; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]879; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]880; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]881; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]882; VI-GISEL-NEXT: v_mov_b32_e32 v4, 0xffffff80883; VI-GISEL-NEXT: v_mov_b32_e32 v5, 0x260884; VI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc885; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v5886; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v4887; VI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc888; VI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc889; VI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.0890; VI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]891; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0892; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]893; VI-GISEL-NEXT: v_div_scale_f64 v[6:7], vcc, 1.0, v[0:1], 1.0894; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.0895; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]896; VI-GISEL-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]897; VI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]898; VI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]899; VI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.0900; VI-GISEL-NEXT: s_setpc_b64 s[30:31]901 %sqrt = call contract double @llvm.sqrt.f64(double %x)902 %rsq = fdiv contract double 1.0, %sqrt903 ret double %rsq904}905 906define double @v_rsq_f64_fabs(double %x) {907; SI-SDAG-LABEL: v_rsq_f64_fabs:908; SI-SDAG: ; %bb.0:909; SI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)910; SI-SDAG-NEXT: s_mov_b32 s4, 0911; SI-SDAG-NEXT: s_brev_b32 s5, 8912; SI-SDAG-NEXT: v_cmp_lt_f64_e64 vcc, |v[0:1]|, s[4:5]913; SI-SDAG-NEXT: v_mov_b32_e32 v2, 0x100914; SI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc915; SI-SDAG-NEXT: v_ldexp_f64 v[0:1], |v[0:1]|, v2916; SI-SDAG-NEXT: v_mov_b32_e32 v8, 0xffffff80917; SI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]918; SI-SDAG-NEXT: v_mov_b32_e32 v9, 0x260919; SI-SDAG-NEXT: s_mov_b32 s6, 0x3ff00000920; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]921; SI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.5922; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.5923; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]924; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]925; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]926; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]927; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]928; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]929; SI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc930; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v4931; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v9932; SI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc933; SI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc934; SI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.0935; SI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]936; SI-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, v1, v3937; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0938; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]939; SI-SDAG-NEXT: v_div_scale_f64 v[6:7], s[4:5], 1.0, v[0:1], 1.0940; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.0941; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]942; SI-SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], s6, v7943; SI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]944; SI-SDAG-NEXT: s_xor_b64 vcc, s[4:5], vcc945; SI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]946; SI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]947; SI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.0948; SI-SDAG-NEXT: s_setpc_b64 s[30:31]949;950; SI-GISEL-LABEL: v_rsq_f64_fabs:951; SI-GISEL: ; %bb.0:952; SI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)953; SI-GISEL-NEXT: v_mov_b32_e32 v2, 0954; SI-GISEL-NEXT: v_bfrev_b32_e32 v3, 8955; SI-GISEL-NEXT: v_cmp_lt_f64_e64 vcc, |v[0:1]|, v[2:3]956; SI-GISEL-NEXT: v_mov_b32_e32 v8, 0xffffff80957; SI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc958; SI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v2959; SI-GISEL-NEXT: v_ldexp_f64 v[0:1], |v[0:1]|, v2960; SI-GISEL-NEXT: v_mov_b32_e32 v9, 0x260961; SI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]962; SI-GISEL-NEXT: v_mov_b32_e32 v10, 0x3ff00000963; SI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.5964; SI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]965; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.5966; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]967; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]968; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]969; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]970; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]971; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]972; SI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc973; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v4974; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v9975; SI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc976; SI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc977; SI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.0978; SI-GISEL-NEXT: v_div_scale_f64 v[8:9], s[4:5], 1.0, v[0:1], 1.0979; SI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]980; SI-GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], v1, v3981; SI-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v9, v10982; SI-GISEL-NEXT: s_xor_b64 vcc, vcc, s[4:5]983; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0984; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]985; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.0986; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]987; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[8:9], v[4:5]988; SI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[6:7], v[8:9]989; SI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[6:7]990; SI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.0991; SI-GISEL-NEXT: s_setpc_b64 s[30:31]992;993; VI-SDAG-LABEL: v_rsq_f64_fabs:994; VI-SDAG: ; %bb.0:995; VI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)996; VI-SDAG-NEXT: s_mov_b32 s4, 0997; VI-SDAG-NEXT: s_brev_b32 s5, 8998; VI-SDAG-NEXT: v_cmp_lt_f64_e64 vcc, |v[0:1]|, s[4:5]999; VI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1001000; VI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc1001; VI-SDAG-NEXT: v_ldexp_f64 v[0:1], |v[0:1]|, v21002; VI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]1003; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]1004; VI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.51005; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.51006; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1007; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]1008; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]1009; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]1010; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]1011; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]1012; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0xffffff801013; VI-SDAG-NEXT: v_mov_b32_e32 v5, 0x2601014; VI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc1015; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v51016; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v41017; VI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc1018; VI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc1019; VI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.01020; VI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]1021; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.01022; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1023; VI-SDAG-NEXT: v_div_scale_f64 v[6:7], vcc, 1.0, v[0:1], 1.01024; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.01025; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]1026; VI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]1027; VI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]1028; VI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]1029; VI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.01030; VI-SDAG-NEXT: s_setpc_b64 s[30:31]1031;1032; VI-GISEL-LABEL: v_rsq_f64_fabs:1033; VI-GISEL: ; %bb.0:1034; VI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)1035; VI-GISEL-NEXT: v_mov_b32_e32 v2, 01036; VI-GISEL-NEXT: v_bfrev_b32_e32 v3, 81037; VI-GISEL-NEXT: v_cmp_lt_f64_e64 vcc, |v[0:1]|, v[2:3]1038; VI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc1039; VI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v21040; VI-GISEL-NEXT: v_ldexp_f64 v[0:1], |v[0:1]|, v21041; VI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]1042; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.51043; VI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]1044; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.51045; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]1046; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1047; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]1048; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]1049; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]1050; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]1051; VI-GISEL-NEXT: v_mov_b32_e32 v4, 0xffffff801052; VI-GISEL-NEXT: v_mov_b32_e32 v5, 0x2601053; VI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc1054; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v51055; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v41056; VI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc1057; VI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc1058; VI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.01059; VI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]1060; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.01061; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1062; VI-GISEL-NEXT: v_div_scale_f64 v[6:7], vcc, 1.0, v[0:1], 1.01063; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.01064; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]1065; VI-GISEL-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]1066; VI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]1067; VI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]1068; VI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.01069; VI-GISEL-NEXT: s_setpc_b64 s[30:31]1070 %fabs.x = call double @llvm.fabs.f64(double %x)1071 %sqrt = call contract double @llvm.sqrt.f64(double %fabs.x)1072 %rsq = fdiv contract double 1.0, %sqrt1073 ret double %rsq1074}1075 1076define double @v_rsq_f64_missing_contract0(double %x) {1077; SI-SDAG-LABEL: v_rsq_f64_missing_contract0:1078; SI-SDAG: ; %bb.0:1079; SI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)1080; SI-SDAG-NEXT: s_mov_b32 s4, 01081; SI-SDAG-NEXT: s_brev_b32 s5, 81082; SI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]1083; SI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1001084; SI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc1085; SI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v21086; SI-SDAG-NEXT: v_mov_b32_e32 v8, 0xffffff801087; SI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]1088; SI-SDAG-NEXT: v_mov_b32_e32 v9, 0x2601089; SI-SDAG-NEXT: s_mov_b32 s6, 0x3ff000001090; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]1091; SI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.51092; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.51093; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1094; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]1095; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]1096; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]1097; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]1098; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]1099; SI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc1100; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v41101; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v91102; SI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc1103; SI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc1104; SI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.01105; SI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]1106; SI-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, v1, v31107; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.01108; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1109; SI-SDAG-NEXT: v_div_scale_f64 v[6:7], s[4:5], 1.0, v[0:1], 1.01110; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.01111; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]1112; SI-SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], s6, v71113; SI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]1114; SI-SDAG-NEXT: s_xor_b64 vcc, s[4:5], vcc1115; SI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]1116; SI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]1117; SI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.01118; SI-SDAG-NEXT: s_setpc_b64 s[30:31]1119;1120; SI-GISEL-LABEL: v_rsq_f64_missing_contract0:1121; SI-GISEL: ; %bb.0:1122; SI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)1123; SI-GISEL-NEXT: v_mov_b32_e32 v2, 01124; SI-GISEL-NEXT: v_bfrev_b32_e32 v3, 81125; SI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]1126; SI-GISEL-NEXT: v_mov_b32_e32 v8, 0xffffff801127; SI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc1128; SI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v21129; SI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v21130; SI-GISEL-NEXT: v_mov_b32_e32 v9, 0x2601131; SI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]1132; SI-GISEL-NEXT: v_mov_b32_e32 v10, 0x3ff000001133; SI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.51134; SI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]1135; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.51136; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]1137; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1138; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]1139; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]1140; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]1141; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]1142; SI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc1143; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v41144; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v91145; SI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc1146; SI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc1147; SI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.01148; SI-GISEL-NEXT: v_div_scale_f64 v[8:9], s[4:5], 1.0, v[0:1], 1.01149; SI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]1150; SI-GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], v1, v31151; SI-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v9, v101152; SI-GISEL-NEXT: s_xor_b64 vcc, vcc, s[4:5]1153; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.01154; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1155; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.01156; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1157; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[8:9], v[4:5]1158; SI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[6:7], v[8:9]1159; SI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[6:7]1160; SI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.01161; SI-GISEL-NEXT: s_setpc_b64 s[30:31]1162;1163; VI-SDAG-LABEL: v_rsq_f64_missing_contract0:1164; VI-SDAG: ; %bb.0:1165; VI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)1166; VI-SDAG-NEXT: s_mov_b32 s4, 01167; VI-SDAG-NEXT: s_brev_b32 s5, 81168; VI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]1169; VI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1001170; VI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc1171; VI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v21172; VI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]1173; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]1174; VI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.51175; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.51176; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1177; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]1178; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]1179; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]1180; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]1181; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]1182; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0xffffff801183; VI-SDAG-NEXT: v_mov_b32_e32 v5, 0x2601184; VI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc1185; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v51186; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v41187; VI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc1188; VI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc1189; VI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.01190; VI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]1191; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.01192; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1193; VI-SDAG-NEXT: v_div_scale_f64 v[6:7], vcc, 1.0, v[0:1], 1.01194; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.01195; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]1196; VI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]1197; VI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]1198; VI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]1199; VI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.01200; VI-SDAG-NEXT: s_setpc_b64 s[30:31]1201;1202; VI-GISEL-LABEL: v_rsq_f64_missing_contract0:1203; VI-GISEL: ; %bb.0:1204; VI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)1205; VI-GISEL-NEXT: v_mov_b32_e32 v2, 01206; VI-GISEL-NEXT: v_bfrev_b32_e32 v3, 81207; VI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]1208; VI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc1209; VI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v21210; VI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v21211; VI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]1212; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.51213; VI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]1214; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.51215; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]1216; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1217; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]1218; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]1219; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]1220; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]1221; VI-GISEL-NEXT: v_mov_b32_e32 v4, 0xffffff801222; VI-GISEL-NEXT: v_mov_b32_e32 v5, 0x2601223; VI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc1224; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v51225; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v41226; VI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc1227; VI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc1228; VI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.01229; VI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]1230; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.01231; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1232; VI-GISEL-NEXT: v_div_scale_f64 v[6:7], vcc, 1.0, v[0:1], 1.01233; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.01234; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]1235; VI-GISEL-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]1236; VI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]1237; VI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]1238; VI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.01239; VI-GISEL-NEXT: s_setpc_b64 s[30:31]1240 %sqrt = call double @llvm.sqrt.f64(double %x)1241 %rsq = fdiv contract double 1.0, %sqrt1242 ret double %rsq1243}1244 1245define double @v_rsq_f64_missing_contract1(double %x) {1246; SI-SDAG-LABEL: v_rsq_f64_missing_contract1:1247; SI-SDAG: ; %bb.0:1248; SI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)1249; SI-SDAG-NEXT: s_mov_b32 s4, 01250; SI-SDAG-NEXT: s_brev_b32 s5, 81251; SI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]1252; SI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1001253; SI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc1254; SI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v21255; SI-SDAG-NEXT: v_mov_b32_e32 v8, 0xffffff801256; SI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]1257; SI-SDAG-NEXT: v_mov_b32_e32 v9, 0x2601258; SI-SDAG-NEXT: s_mov_b32 s6, 0x3ff000001259; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]1260; SI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.51261; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.51262; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1263; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]1264; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]1265; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]1266; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]1267; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]1268; SI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc1269; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v41270; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v91271; SI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc1272; SI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc1273; SI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.01274; SI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]1275; SI-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, v1, v31276; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.01277; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1278; SI-SDAG-NEXT: v_div_scale_f64 v[6:7], s[4:5], 1.0, v[0:1], 1.01279; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.01280; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]1281; SI-SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], s6, v71282; SI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]1283; SI-SDAG-NEXT: s_xor_b64 vcc, s[4:5], vcc1284; SI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]1285; SI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]1286; SI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.01287; SI-SDAG-NEXT: s_setpc_b64 s[30:31]1288;1289; SI-GISEL-LABEL: v_rsq_f64_missing_contract1:1290; SI-GISEL: ; %bb.0:1291; SI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)1292; SI-GISEL-NEXT: v_mov_b32_e32 v2, 01293; SI-GISEL-NEXT: v_bfrev_b32_e32 v3, 81294; SI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]1295; SI-GISEL-NEXT: v_mov_b32_e32 v8, 0xffffff801296; SI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc1297; SI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v21298; SI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v21299; SI-GISEL-NEXT: v_mov_b32_e32 v9, 0x2601300; SI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]1301; SI-GISEL-NEXT: v_mov_b32_e32 v10, 0x3ff000001302; SI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.51303; SI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]1304; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.51305; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]1306; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1307; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]1308; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]1309; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]1310; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]1311; SI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc1312; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v41313; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v91314; SI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc1315; SI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc1316; SI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.01317; SI-GISEL-NEXT: v_div_scale_f64 v[8:9], s[4:5], 1.0, v[0:1], 1.01318; SI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]1319; SI-GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], v1, v31320; SI-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v9, v101321; SI-GISEL-NEXT: s_xor_b64 vcc, vcc, s[4:5]1322; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.01323; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1324; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.01325; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1326; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[8:9], v[4:5]1327; SI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[6:7], v[8:9]1328; SI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[6:7]1329; SI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.01330; SI-GISEL-NEXT: s_setpc_b64 s[30:31]1331;1332; VI-SDAG-LABEL: v_rsq_f64_missing_contract1:1333; VI-SDAG: ; %bb.0:1334; VI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)1335; VI-SDAG-NEXT: s_mov_b32 s4, 01336; VI-SDAG-NEXT: s_brev_b32 s5, 81337; VI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]1338; VI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1001339; VI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc1340; VI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v21341; VI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]1342; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]1343; VI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.51344; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.51345; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1346; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]1347; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]1348; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]1349; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]1350; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]1351; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0xffffff801352; VI-SDAG-NEXT: v_mov_b32_e32 v5, 0x2601353; VI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc1354; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v51355; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v41356; VI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc1357; VI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc1358; VI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.01359; VI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]1360; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.01361; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1362; VI-SDAG-NEXT: v_div_scale_f64 v[6:7], vcc, 1.0, v[0:1], 1.01363; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.01364; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]1365; VI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]1366; VI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]1367; VI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]1368; VI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.01369; VI-SDAG-NEXT: s_setpc_b64 s[30:31]1370;1371; VI-GISEL-LABEL: v_rsq_f64_missing_contract1:1372; VI-GISEL: ; %bb.0:1373; VI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)1374; VI-GISEL-NEXT: v_mov_b32_e32 v2, 01375; VI-GISEL-NEXT: v_bfrev_b32_e32 v3, 81376; VI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]1377; VI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc1378; VI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v21379; VI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v21380; VI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]1381; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.51382; VI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]1383; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.51384; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]1385; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1386; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]1387; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]1388; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]1389; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]1390; VI-GISEL-NEXT: v_mov_b32_e32 v4, 0xffffff801391; VI-GISEL-NEXT: v_mov_b32_e32 v5, 0x2601392; VI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc1393; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v51394; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v41395; VI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc1396; VI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc1397; VI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.01398; VI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]1399; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.01400; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1401; VI-GISEL-NEXT: v_div_scale_f64 v[6:7], vcc, 1.0, v[0:1], 1.01402; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.01403; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]1404; VI-GISEL-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]1405; VI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]1406; VI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]1407; VI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.01408; VI-GISEL-NEXT: s_setpc_b64 s[30:31]1409 %sqrt = call contract double @llvm.sqrt.f64(double %x)1410 %rsq = fdiv double 1.0, %sqrt1411 ret double %rsq1412}1413 1414define double @v_neg_rsq_f64(double %x) {1415; SI-SDAG-LABEL: v_neg_rsq_f64:1416; SI-SDAG: ; %bb.0:1417; SI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)1418; SI-SDAG-NEXT: s_mov_b32 s4, 01419; SI-SDAG-NEXT: s_brev_b32 s5, 81420; SI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]1421; SI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1001422; SI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc1423; SI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v21424; SI-SDAG-NEXT: v_mov_b32_e32 v8, 0xffffff801425; SI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]1426; SI-SDAG-NEXT: v_mov_b32_e32 v9, 0x2601427; SI-SDAG-NEXT: s_mov_b32 s6, 0xbff000001428; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]1429; SI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.51430; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.51431; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1432; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]1433; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]1434; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]1435; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]1436; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]1437; SI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc1438; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v41439; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v91440; SI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc1441; SI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc1442; SI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], -1.01443; SI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]1444; SI-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, v1, v31445; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.01446; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1447; SI-SDAG-NEXT: v_div_scale_f64 v[6:7], s[4:5], -1.0, v[0:1], -1.01448; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.01449; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]1450; SI-SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], s6, v71451; SI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]1452; SI-SDAG-NEXT: s_xor_b64 vcc, s[4:5], vcc1453; SI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]1454; SI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]1455; SI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], -1.01456; SI-SDAG-NEXT: s_setpc_b64 s[30:31]1457;1458; SI-GISEL-LABEL: v_neg_rsq_f64:1459; SI-GISEL: ; %bb.0:1460; SI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)1461; SI-GISEL-NEXT: v_mov_b32_e32 v2, 01462; SI-GISEL-NEXT: v_bfrev_b32_e32 v3, 81463; SI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]1464; SI-GISEL-NEXT: v_mov_b32_e32 v8, 0xffffff801465; SI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc1466; SI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v21467; SI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v21468; SI-GISEL-NEXT: v_mov_b32_e32 v9, 0x2601469; SI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]1470; SI-GISEL-NEXT: v_mov_b32_e32 v10, 0xbff000001471; SI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.51472; SI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]1473; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.51474; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]1475; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1476; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]1477; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]1478; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]1479; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]1480; SI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc1481; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v41482; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v91483; SI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc1484; SI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc1485; SI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], -1.01486; SI-GISEL-NEXT: v_div_scale_f64 v[8:9], s[4:5], -1.0, v[0:1], -1.01487; SI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]1488; SI-GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], v1, v31489; SI-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v9, v101490; SI-GISEL-NEXT: s_xor_b64 vcc, vcc, s[4:5]1491; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.01492; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1493; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.01494; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1495; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[8:9], v[4:5]1496; SI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[6:7], v[8:9]1497; SI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[6:7]1498; SI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], -1.01499; SI-GISEL-NEXT: s_setpc_b64 s[30:31]1500;1501; VI-SDAG-LABEL: v_neg_rsq_f64:1502; VI-SDAG: ; %bb.0:1503; VI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)1504; VI-SDAG-NEXT: s_mov_b32 s4, 01505; VI-SDAG-NEXT: s_brev_b32 s5, 81506; VI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]1507; VI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1001508; VI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc1509; VI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v21510; VI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]1511; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]1512; VI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.51513; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.51514; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1515; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]1516; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]1517; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]1518; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]1519; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]1520; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0xffffff801521; VI-SDAG-NEXT: v_mov_b32_e32 v5, 0x2601522; VI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc1523; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v51524; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v41525; VI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc1526; VI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc1527; VI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], -1.01528; VI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]1529; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.01530; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1531; VI-SDAG-NEXT: v_div_scale_f64 v[6:7], vcc, -1.0, v[0:1], -1.01532; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.01533; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]1534; VI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]1535; VI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]1536; VI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]1537; VI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], -1.01538; VI-SDAG-NEXT: s_setpc_b64 s[30:31]1539;1540; VI-GISEL-LABEL: v_neg_rsq_f64:1541; VI-GISEL: ; %bb.0:1542; VI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)1543; VI-GISEL-NEXT: v_mov_b32_e32 v2, 01544; VI-GISEL-NEXT: v_bfrev_b32_e32 v3, 81545; VI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]1546; VI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc1547; VI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v21548; VI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v21549; VI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]1550; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.51551; VI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]1552; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.51553; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]1554; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1555; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]1556; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]1557; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]1558; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]1559; VI-GISEL-NEXT: v_mov_b32_e32 v4, 0xffffff801560; VI-GISEL-NEXT: v_mov_b32_e32 v5, 0x2601561; VI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc1562; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v51563; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v41564; VI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc1565; VI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc1566; VI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], -1.01567; VI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]1568; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.01569; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]1570; VI-GISEL-NEXT: v_div_scale_f64 v[6:7], vcc, -1.0, v[0:1], -1.01571; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.01572; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]1573; VI-GISEL-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]1574; VI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]1575; VI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]1576; VI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], -1.01577; VI-GISEL-NEXT: s_setpc_b64 s[30:31]1578 %sqrt = call contract double @llvm.sqrt.f64(double %x)1579 %rsq = fdiv contract double -1.0, %sqrt1580 ret double %rsq1581}1582 1583define <2 x double> @v_rsq_v2f64(<2 x double> %x) {1584; SI-SDAG-LABEL: v_rsq_v2f64:1585; SI-SDAG: ; %bb.0:1586; SI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)1587; SI-SDAG-NEXT: s_mov_b32 s4, 01588; SI-SDAG-NEXT: s_brev_b32 s5, 81589; SI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[2:3]1590; SI-SDAG-NEXT: v_cmp_gt_f64_e64 s[4:5], s[4:5], v[0:1]1591; SI-SDAG-NEXT: v_mov_b32_e32 v6, 0x1001592; SI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v6, vcc1593; SI-SDAG-NEXT: v_cndmask_b32_e64 v6, 0, v6, s[4:5]1594; SI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v61595; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v41596; SI-SDAG-NEXT: v_rsq_f64_e32 v[6:7], v[0:1]1597; SI-SDAG-NEXT: v_rsq_f64_e32 v[4:5], v[2:3]1598; SI-SDAG-NEXT: s_mov_b32 s6, 0x3ff000001599; SI-SDAG-NEXT: v_mul_f64 v[10:11], v[0:1], v[6:7]1600; SI-SDAG-NEXT: v_mul_f64 v[6:7], v[6:7], 0.51601; SI-SDAG-NEXT: v_mul_f64 v[8:9], v[2:3], v[4:5]1602; SI-SDAG-NEXT: v_fma_f64 v[14:15], -v[6:7], v[10:11], 0.51603; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[4:5], 0.51604; SI-SDAG-NEXT: v_fma_f64 v[10:11], v[10:11], v[14:15], v[10:11]1605; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[14:15], v[6:7]1606; SI-SDAG-NEXT: v_fma_f64 v[18:19], -v[10:11], v[10:11], v[0:1]1607; SI-SDAG-NEXT: v_fma_f64 v[12:13], -v[4:5], v[8:9], 0.51608; SI-SDAG-NEXT: v_fma_f64 v[10:11], v[18:19], v[6:7], v[10:11]1609; SI-SDAG-NEXT: v_fma_f64 v[8:9], v[8:9], v[12:13], v[8:9]1610; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[12:13], v[4:5]1611; SI-SDAG-NEXT: v_fma_f64 v[12:13], -v[10:11], v[10:11], v[0:1]1612; SI-SDAG-NEXT: v_mov_b32_e32 v14, 0xffffff801613; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[12:13], v[6:7], v[10:11]1614; SI-SDAG-NEXT: v_mov_b32_e32 v15, 0x2601615; SI-SDAG-NEXT: v_cndmask_b32_e64 v10, 0, v14, s[4:5]1616; SI-SDAG-NEXT: v_ldexp_f64 v[6:7], v[6:7], v101617; SI-SDAG-NEXT: v_cmp_class_f64_e64 s[4:5], v[0:1], v151618; SI-SDAG-NEXT: v_fma_f64 v[16:17], -v[8:9], v[8:9], v[2:3]1619; SI-SDAG-NEXT: v_cndmask_b32_e64 v1, v7, v1, s[4:5]1620; SI-SDAG-NEXT: v_cndmask_b32_e64 v0, v6, v0, s[4:5]1621; SI-SDAG-NEXT: v_div_scale_f64 v[6:7], s[4:5], v[0:1], v[0:1], 1.01622; SI-SDAG-NEXT: v_fma_f64 v[8:9], v[16:17], v[4:5], v[8:9]1623; SI-SDAG-NEXT: v_fma_f64 v[10:11], -v[8:9], v[8:9], v[2:3]1624; SI-SDAG-NEXT: v_rcp_f64_e32 v[12:13], v[6:7]1625; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[10:11], v[4:5], v[8:9]1626; SI-SDAG-NEXT: v_cndmask_b32_e32 v8, 0, v14, vcc1627; SI-SDAG-NEXT: v_ldexp_f64 v[4:5], v[4:5], v81628; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[2:3], v151629; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[6:7], v[12:13], 1.01630; SI-SDAG-NEXT: v_cndmask_b32_e32 v3, v5, v3, vcc1631; SI-SDAG-NEXT: v_cndmask_b32_e32 v2, v4, v2, vcc1632; SI-SDAG-NEXT: v_fma_f64 v[8:9], v[12:13], v[8:9], v[12:13]1633; SI-SDAG-NEXT: v_div_scale_f64 v[10:11], s[4:5], v[2:3], v[2:3], 1.01634; SI-SDAG-NEXT: v_fma_f64 v[4:5], -v[6:7], v[8:9], 1.01635; SI-SDAG-NEXT: v_div_scale_f64 v[12:13], s[4:5], 1.0, v[0:1], 1.01636; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[8:9], v[4:5], v[8:9]1637; SI-SDAG-NEXT: v_rcp_f64_e32 v[8:9], v[10:11]1638; SI-SDAG-NEXT: v_mul_f64 v[14:15], v[12:13], v[4:5]1639; SI-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, v1, v71640; SI-SDAG-NEXT: v_fma_f64 v[16:17], -v[6:7], v[14:15], v[12:13]1641; SI-SDAG-NEXT: v_fma_f64 v[18:19], -v[10:11], v[8:9], 1.01642; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[8:9], v[18:19], v[8:9]1643; SI-SDAG-NEXT: v_div_scale_f64 v[18:19], s[4:5], 1.0, v[2:3], 1.01644; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[10:11], v[6:7], 1.01645; SI-SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], s6, v131646; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]1647; SI-SDAG-NEXT: s_xor_b64 vcc, s[4:5], vcc1648; SI-SDAG-NEXT: v_mul_f64 v[8:9], v[18:19], v[6:7]1649; SI-SDAG-NEXT: v_div_fmas_f64 v[4:5], v[16:17], v[4:5], v[14:15]1650; SI-SDAG-NEXT: v_fma_f64 v[12:13], -v[10:11], v[8:9], v[18:19]1651; SI-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, v3, v111652; SI-SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], s6, v191653; SI-SDAG-NEXT: s_xor_b64 vcc, s[4:5], vcc1654; SI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[4:5], v[0:1], 1.01655; SI-SDAG-NEXT: s_nop 01656; SI-SDAG-NEXT: v_div_fmas_f64 v[6:7], v[12:13], v[6:7], v[8:9]1657; SI-SDAG-NEXT: v_div_fixup_f64 v[2:3], v[6:7], v[2:3], 1.01658; SI-SDAG-NEXT: s_setpc_b64 s[30:31]1659;1660; SI-GISEL-LABEL: v_rsq_v2f64:1661; SI-GISEL: ; %bb.0:1662; SI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)1663; SI-GISEL-NEXT: v_mov_b32_e32 v4, 01664; SI-GISEL-NEXT: v_bfrev_b32_e32 v5, 81665; SI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[4:5]1666; SI-GISEL-NEXT: v_cmp_lt_f64_e64 s[4:5], v[2:3], v[4:5]1667; SI-GISEL-NEXT: v_cndmask_b32_e64 v6, 0, 1, vcc1668; SI-GISEL-NEXT: v_lshlrev_b32_e32 v6, 8, v61669; SI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v61670; SI-GISEL-NEXT: v_cndmask_b32_e64 v12, 0, 1, s[4:5]1671; SI-GISEL-NEXT: v_rsq_f64_e32 v[6:7], v[0:1]1672; SI-GISEL-NEXT: v_mov_b32_e32 v14, 0xffffff801673; SI-GISEL-NEXT: v_mov_b32_e32 v15, 0x2601674; SI-GISEL-NEXT: v_mov_b32_e32 v18, 0x3ff000001675; SI-GISEL-NEXT: v_mul_f64 v[8:9], v[6:7], 0.51676; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[0:1], v[6:7]1677; SI-GISEL-NEXT: v_fma_f64 v[10:11], -v[8:9], v[6:7], 0.51678; SI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[10:11], v[6:7]1679; SI-GISEL-NEXT: v_fma_f64 v[8:9], v[8:9], v[10:11], v[8:9]1680; SI-GISEL-NEXT: v_fma_f64 v[10:11], -v[6:7], v[6:7], v[0:1]1681; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[10:11], v[8:9], v[6:7]1682; SI-GISEL-NEXT: v_lshlrev_b32_e32 v10, 8, v121683; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]1684; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v101685; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[6:7], v[8:9], v[4:5]1686; SI-GISEL-NEXT: v_rsq_f64_e32 v[6:7], v[2:3]1687; SI-GISEL-NEXT: v_cndmask_b32_e32 v8, 0, v14, vcc1688; SI-GISEL-NEXT: v_ldexp_f64 v[4:5], v[4:5], v81689; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v151690; SI-GISEL-NEXT: v_mul_f64 v[8:9], v[6:7], 0.51691; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[2:3], v[6:7]1692; SI-GISEL-NEXT: v_cndmask_b32_e32 v0, v4, v0, vcc1693; SI-GISEL-NEXT: v_fma_f64 v[10:11], -v[8:9], v[6:7], 0.51694; SI-GISEL-NEXT: v_cndmask_b32_e32 v1, v5, v1, vcc1695; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[6:7], v[10:11], v[6:7]1696; SI-GISEL-NEXT: v_fma_f64 v[6:7], v[8:9], v[10:11], v[8:9]1697; SI-GISEL-NEXT: v_fma_f64 v[8:9], -v[4:5], v[4:5], v[2:3]1698; SI-GISEL-NEXT: v_div_scale_f64 v[10:11], s[6:7], v[0:1], v[0:1], 1.01699; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[8:9], v[6:7], v[4:5]1700; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[2:3], v151701; SI-GISEL-NEXT: v_fma_f64 v[8:9], -v[4:5], v[4:5], v[2:3]1702; SI-GISEL-NEXT: v_rcp_f64_e32 v[12:13], v[10:11]1703; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[8:9], v[6:7], v[4:5]1704; SI-GISEL-NEXT: v_cndmask_b32_e64 v6, 0, v14, s[4:5]1705; SI-GISEL-NEXT: v_ldexp_f64 v[4:5], v[4:5], v61706; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[10:11], v[12:13], 1.01707; SI-GISEL-NEXT: v_cndmask_b32_e32 v2, v4, v2, vcc1708; SI-GISEL-NEXT: v_cndmask_b32_e32 v3, v5, v3, vcc1709; SI-GISEL-NEXT: v_fma_f64 v[6:7], v[12:13], v[6:7], v[12:13]1710; SI-GISEL-NEXT: v_div_scale_f64 v[8:9], s[4:5], v[2:3], v[2:3], 1.01711; SI-GISEL-NEXT: v_fma_f64 v[4:5], -v[10:11], v[6:7], 1.01712; SI-GISEL-NEXT: v_div_scale_f64 v[12:13], s[4:5], 1.0, v[0:1], 1.01713; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[6:7], v[4:5], v[6:7]1714; SI-GISEL-NEXT: v_rcp_f64_e32 v[6:7], v[8:9]1715; SI-GISEL-NEXT: v_mul_f64 v[14:15], v[12:13], v[4:5]1716; SI-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v13, v181717; SI-GISEL-NEXT: v_fma_f64 v[12:13], -v[10:11], v[14:15], v[12:13]1718; SI-GISEL-NEXT: v_fma_f64 v[16:17], -v[8:9], v[6:7], 1.01719; SI-GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], v1, v111720; SI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[16:17], v[6:7]1721; SI-GISEL-NEXT: v_div_scale_f64 v[16:17], s[6:7], 1.0, v[2:3], 1.01722; SI-GISEL-NEXT: v_fma_f64 v[10:11], -v[8:9], v[6:7], 1.01723; SI-GISEL-NEXT: s_xor_b64 vcc, vcc, s[4:5]1724; SI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[10:11], v[6:7]1725; SI-GISEL-NEXT: v_div_fmas_f64 v[4:5], v[12:13], v[4:5], v[14:15]1726; SI-GISEL-NEXT: v_mul_f64 v[10:11], v[16:17], v[6:7]1727; SI-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v17, v181728; SI-GISEL-NEXT: v_fma_f64 v[12:13], -v[8:9], v[10:11], v[16:17]1729; SI-GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], v3, v91730; SI-GISEL-NEXT: s_xor_b64 vcc, vcc, s[4:5]1731; SI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[4:5], v[0:1], 1.01732; SI-GISEL-NEXT: v_div_fmas_f64 v[6:7], v[12:13], v[6:7], v[10:11]1733; SI-GISEL-NEXT: v_div_fixup_f64 v[2:3], v[6:7], v[2:3], 1.01734; SI-GISEL-NEXT: s_setpc_b64 s[30:31]1735;1736; VI-SDAG-LABEL: v_rsq_v2f64:1737; VI-SDAG: ; %bb.0:1738; VI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)1739; VI-SDAG-NEXT: s_mov_b32 s4, 01740; VI-SDAG-NEXT: s_brev_b32 s5, 81741; VI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[2:3]1742; VI-SDAG-NEXT: v_cmp_gt_f64_e64 s[4:5], s[4:5], v[0:1]1743; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0x1001744; VI-SDAG-NEXT: v_cndmask_b32_e32 v5, 0, v4, vcc1745; VI-SDAG-NEXT: v_cndmask_b32_e64 v4, 0, v4, s[4:5]1746; VI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v41747; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v51748; VI-SDAG-NEXT: v_rsq_f64_e32 v[6:7], v[0:1]1749; VI-SDAG-NEXT: v_rsq_f64_e32 v[4:5], v[2:3]1750; VI-SDAG-NEXT: v_mul_f64 v[10:11], v[0:1], v[6:7]1751; VI-SDAG-NEXT: v_mul_f64 v[6:7], v[6:7], 0.51752; VI-SDAG-NEXT: v_mul_f64 v[8:9], v[2:3], v[4:5]1753; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[4:5], 0.51754; VI-SDAG-NEXT: v_fma_f64 v[14:15], -v[6:7], v[10:11], 0.51755; VI-SDAG-NEXT: v_fma_f64 v[12:13], -v[4:5], v[8:9], 0.51756; VI-SDAG-NEXT: v_fma_f64 v[10:11], v[10:11], v[14:15], v[10:11]1757; VI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[14:15], v[6:7]1758; VI-SDAG-NEXT: v_fma_f64 v[8:9], v[8:9], v[12:13], v[8:9]1759; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[12:13], v[4:5]1760; VI-SDAG-NEXT: v_fma_f64 v[14:15], -v[10:11], v[10:11], v[0:1]1761; VI-SDAG-NEXT: v_fma_f64 v[12:13], -v[8:9], v[8:9], v[2:3]1762; VI-SDAG-NEXT: v_fma_f64 v[10:11], v[14:15], v[6:7], v[10:11]1763; VI-SDAG-NEXT: v_fma_f64 v[8:9], v[12:13], v[4:5], v[8:9]1764; VI-SDAG-NEXT: v_fma_f64 v[14:15], -v[10:11], v[10:11], v[0:1]1765; VI-SDAG-NEXT: v_fma_f64 v[12:13], -v[8:9], v[8:9], v[2:3]1766; VI-SDAG-NEXT: v_fma_f64 v[6:7], v[14:15], v[6:7], v[10:11]1767; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[12:13], v[4:5], v[8:9]1768; VI-SDAG-NEXT: v_mov_b32_e32 v8, 0xffffff801769; VI-SDAG-NEXT: v_mov_b32_e32 v9, 0x2601770; VI-SDAG-NEXT: v_cndmask_b32_e32 v10, 0, v8, vcc1771; VI-SDAG-NEXT: v_cndmask_b32_e64 v8, 0, v8, s[4:5]1772; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v91773; VI-SDAG-NEXT: v_ldexp_f64 v[6:7], v[6:7], v81774; VI-SDAG-NEXT: v_cmp_class_f64_e64 s[4:5], v[2:3], v91775; VI-SDAG-NEXT: v_ldexp_f64 v[4:5], v[4:5], v101776; VI-SDAG-NEXT: v_cndmask_b32_e32 v1, v7, v1, vcc1777; VI-SDAG-NEXT: v_cndmask_b32_e32 v0, v6, v0, vcc1778; VI-SDAG-NEXT: v_cndmask_b32_e64 v3, v5, v3, s[4:5]1779; VI-SDAG-NEXT: v_div_scale_f64 v[5:6], s[6:7], v[0:1], v[0:1], 1.01780; VI-SDAG-NEXT: v_cndmask_b32_e64 v2, v4, v2, s[4:5]1781; VI-SDAG-NEXT: v_div_scale_f64 v[7:8], s[4:5], v[2:3], v[2:3], 1.01782; VI-SDAG-NEXT: v_div_scale_f64 v[17:18], s[4:5], 1.0, v[2:3], 1.01783; VI-SDAG-NEXT: v_rcp_f64_e32 v[9:10], v[5:6]1784; VI-SDAG-NEXT: v_rcp_f64_e32 v[11:12], v[7:8]1785; VI-SDAG-NEXT: v_fma_f64 v[13:14], -v[5:6], v[9:10], 1.01786; VI-SDAG-NEXT: v_fma_f64 v[15:16], -v[7:8], v[11:12], 1.01787; VI-SDAG-NEXT: v_fma_f64 v[9:10], v[9:10], v[13:14], v[9:10]1788; VI-SDAG-NEXT: v_div_scale_f64 v[13:14], vcc, 1.0, v[0:1], 1.01789; VI-SDAG-NEXT: v_fma_f64 v[11:12], v[11:12], v[15:16], v[11:12]1790; VI-SDAG-NEXT: v_fma_f64 v[15:16], -v[5:6], v[9:10], 1.01791; VI-SDAG-NEXT: v_fma_f64 v[19:20], -v[7:8], v[11:12], 1.01792; VI-SDAG-NEXT: v_fma_f64 v[9:10], v[9:10], v[15:16], v[9:10]1793; VI-SDAG-NEXT: v_fma_f64 v[11:12], v[11:12], v[19:20], v[11:12]1794; VI-SDAG-NEXT: v_mul_f64 v[15:16], v[13:14], v[9:10]1795; VI-SDAG-NEXT: v_mul_f64 v[19:20], v[17:18], v[11:12]1796; VI-SDAG-NEXT: v_fma_f64 v[4:5], -v[5:6], v[15:16], v[13:14]1797; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[7:8], v[19:20], v[17:18]1798; VI-SDAG-NEXT: v_div_fmas_f64 v[4:5], v[4:5], v[9:10], v[15:16]1799; VI-SDAG-NEXT: s_mov_b64 vcc, s[4:5]1800; VI-SDAG-NEXT: v_div_fmas_f64 v[6:7], v[6:7], v[11:12], v[19:20]1801; VI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[4:5], v[0:1], 1.01802; VI-SDAG-NEXT: v_div_fixup_f64 v[2:3], v[6:7], v[2:3], 1.01803; VI-SDAG-NEXT: s_setpc_b64 s[30:31]1804;1805; VI-GISEL-LABEL: v_rsq_v2f64:1806; VI-GISEL: ; %bb.0:1807; VI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)1808; VI-GISEL-NEXT: v_mov_b32_e32 v4, 01809; VI-GISEL-NEXT: v_bfrev_b32_e32 v5, 81810; VI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[4:5]1811; VI-GISEL-NEXT: v_cmp_lt_f64_e64 s[4:5], v[2:3], v[4:5]1812; VI-GISEL-NEXT: v_cndmask_b32_e64 v6, 0, 1, vcc1813; VI-GISEL-NEXT: v_lshlrev_b32_e32 v6, 8, v61814; VI-GISEL-NEXT: v_cndmask_b32_e64 v4, 0, 1, s[4:5]1815; VI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v61816; VI-GISEL-NEXT: v_lshlrev_b32_e32 v4, 8, v41817; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v41818; VI-GISEL-NEXT: v_rsq_f64_e32 v[4:5], v[0:1]1819; VI-GISEL-NEXT: v_rsq_f64_e32 v[6:7], v[2:3]1820; VI-GISEL-NEXT: v_mul_f64 v[8:9], v[4:5], 0.51821; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[0:1], v[4:5]1822; VI-GISEL-NEXT: v_mul_f64 v[10:11], v[6:7], 0.51823; VI-GISEL-NEXT: v_mul_f64 v[6:7], v[2:3], v[6:7]1824; VI-GISEL-NEXT: v_fma_f64 v[12:13], -v[8:9], v[4:5], 0.51825; VI-GISEL-NEXT: v_fma_f64 v[14:15], -v[10:11], v[6:7], 0.51826; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[12:13], v[4:5]1827; VI-GISEL-NEXT: v_fma_f64 v[8:9], v[8:9], v[12:13], v[8:9]1828; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[14:15], v[6:7]1829; VI-GISEL-NEXT: v_fma_f64 v[10:11], v[10:11], v[14:15], v[10:11]1830; VI-GISEL-NEXT: v_fma_f64 v[12:13], -v[4:5], v[4:5], v[0:1]1831; VI-GISEL-NEXT: v_fma_f64 v[14:15], -v[6:7], v[6:7], v[2:3]1832; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[12:13], v[8:9], v[4:5]1833; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[14:15], v[10:11], v[6:7]1834; VI-GISEL-NEXT: v_fma_f64 v[12:13], -v[4:5], v[4:5], v[0:1]1835; VI-GISEL-NEXT: v_fma_f64 v[14:15], -v[6:7], v[6:7], v[2:3]1836; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[12:13], v[8:9], v[4:5]1837; VI-GISEL-NEXT: v_mov_b32_e32 v8, 0xffffff801838; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[14:15], v[10:11], v[6:7]1839; VI-GISEL-NEXT: v_mov_b32_e32 v9, 0x2601840; VI-GISEL-NEXT: v_cndmask_b32_e32 v10, 0, v8, vcc1841; VI-GISEL-NEXT: v_cndmask_b32_e64 v8, 0, v8, s[4:5]1842; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v91843; VI-GISEL-NEXT: v_cmp_class_f64_e64 s[4:5], v[2:3], v91844; VI-GISEL-NEXT: v_ldexp_f64 v[4:5], v[4:5], v101845; VI-GISEL-NEXT: v_ldexp_f64 v[6:7], v[6:7], v81846; VI-GISEL-NEXT: v_cndmask_b32_e32 v0, v4, v0, vcc1847; VI-GISEL-NEXT: v_cndmask_b32_e32 v1, v5, v1, vcc1848; VI-GISEL-NEXT: v_cndmask_b32_e64 v2, v6, v2, s[4:5]1849; VI-GISEL-NEXT: v_div_scale_f64 v[4:5], s[6:7], v[0:1], v[0:1], 1.01850; VI-GISEL-NEXT: v_cndmask_b32_e64 v3, v7, v3, s[4:5]1851; VI-GISEL-NEXT: v_div_scale_f64 v[6:7], s[4:5], v[2:3], v[2:3], 1.01852; VI-GISEL-NEXT: v_div_scale_f64 v[16:17], s[4:5], 1.0, v[2:3], 1.01853; VI-GISEL-NEXT: v_rcp_f64_e32 v[8:9], v[4:5]1854; VI-GISEL-NEXT: v_rcp_f64_e32 v[10:11], v[6:7]1855; VI-GISEL-NEXT: v_fma_f64 v[12:13], -v[4:5], v[8:9], 1.01856; VI-GISEL-NEXT: v_fma_f64 v[14:15], -v[6:7], v[10:11], 1.01857; VI-GISEL-NEXT: v_fma_f64 v[8:9], v[8:9], v[12:13], v[8:9]1858; VI-GISEL-NEXT: v_div_scale_f64 v[12:13], vcc, 1.0, v[0:1], 1.01859; VI-GISEL-NEXT: v_fma_f64 v[10:11], v[10:11], v[14:15], v[10:11]1860; VI-GISEL-NEXT: v_fma_f64 v[14:15], -v[4:5], v[8:9], 1.01861; VI-GISEL-NEXT: v_fma_f64 v[18:19], -v[6:7], v[10:11], 1.01862; VI-GISEL-NEXT: v_fma_f64 v[8:9], v[8:9], v[14:15], v[8:9]1863; VI-GISEL-NEXT: v_fma_f64 v[10:11], v[10:11], v[18:19], v[10:11]1864; VI-GISEL-NEXT: v_mul_f64 v[14:15], v[12:13], v[8:9]1865; VI-GISEL-NEXT: v_mul_f64 v[18:19], v[16:17], v[10:11]1866; VI-GISEL-NEXT: v_fma_f64 v[4:5], -v[4:5], v[14:15], v[12:13]1867; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[6:7], v[18:19], v[16:17]1868; VI-GISEL-NEXT: v_div_fmas_f64 v[4:5], v[4:5], v[8:9], v[14:15]1869; VI-GISEL-NEXT: s_mov_b64 vcc, s[4:5]1870; VI-GISEL-NEXT: v_div_fmas_f64 v[6:7], v[6:7], v[10:11], v[18:19]1871; VI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[4:5], v[0:1], 1.01872; VI-GISEL-NEXT: v_div_fixup_f64 v[2:3], v[6:7], v[2:3], 1.01873; VI-GISEL-NEXT: s_setpc_b64 s[30:31]1874 %sqrt = call <2 x double> @llvm.sqrt.v2f64(<2 x double> %x)1875 %rsq = fdiv <2 x double> <double 1.0, double 1.0>, %sqrt1876 ret <2 x double> %rsq1877}1878 1879define <2 x double> @v_neg_rsq_v2f64(<2 x double> %x) {1880; SI-SDAG-LABEL: v_neg_rsq_v2f64:1881; SI-SDAG: ; %bb.0:1882; SI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)1883; SI-SDAG-NEXT: s_mov_b32 s4, 01884; SI-SDAG-NEXT: s_brev_b32 s5, 81885; SI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[2:3]1886; SI-SDAG-NEXT: v_cmp_gt_f64_e64 s[4:5], s[4:5], v[0:1]1887; SI-SDAG-NEXT: v_mov_b32_e32 v6, 0x1001888; SI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v6, vcc1889; SI-SDAG-NEXT: v_cndmask_b32_e64 v6, 0, v6, s[4:5]1890; SI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v61891; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v41892; SI-SDAG-NEXT: v_rsq_f64_e32 v[6:7], v[0:1]1893; SI-SDAG-NEXT: v_rsq_f64_e32 v[4:5], v[2:3]1894; SI-SDAG-NEXT: s_mov_b32 s6, 0xbff000001895; SI-SDAG-NEXT: v_mul_f64 v[10:11], v[0:1], v[6:7]1896; SI-SDAG-NEXT: v_mul_f64 v[6:7], v[6:7], 0.51897; SI-SDAG-NEXT: v_mul_f64 v[8:9], v[2:3], v[4:5]1898; SI-SDAG-NEXT: v_fma_f64 v[14:15], -v[6:7], v[10:11], 0.51899; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[4:5], 0.51900; SI-SDAG-NEXT: v_fma_f64 v[10:11], v[10:11], v[14:15], v[10:11]1901; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[14:15], v[6:7]1902; SI-SDAG-NEXT: v_fma_f64 v[18:19], -v[10:11], v[10:11], v[0:1]1903; SI-SDAG-NEXT: v_fma_f64 v[12:13], -v[4:5], v[8:9], 0.51904; SI-SDAG-NEXT: v_fma_f64 v[10:11], v[18:19], v[6:7], v[10:11]1905; SI-SDAG-NEXT: v_fma_f64 v[8:9], v[8:9], v[12:13], v[8:9]1906; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[12:13], v[4:5]1907; SI-SDAG-NEXT: v_fma_f64 v[12:13], -v[10:11], v[10:11], v[0:1]1908; SI-SDAG-NEXT: v_mov_b32_e32 v14, 0xffffff801909; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[12:13], v[6:7], v[10:11]1910; SI-SDAG-NEXT: v_mov_b32_e32 v15, 0x2601911; SI-SDAG-NEXT: v_cndmask_b32_e64 v10, 0, v14, s[4:5]1912; SI-SDAG-NEXT: v_ldexp_f64 v[6:7], v[6:7], v101913; SI-SDAG-NEXT: v_cmp_class_f64_e64 s[4:5], v[0:1], v151914; SI-SDAG-NEXT: v_fma_f64 v[16:17], -v[8:9], v[8:9], v[2:3]1915; SI-SDAG-NEXT: v_cndmask_b32_e64 v1, v7, v1, s[4:5]1916; SI-SDAG-NEXT: v_cndmask_b32_e64 v0, v6, v0, s[4:5]1917; SI-SDAG-NEXT: v_div_scale_f64 v[6:7], s[4:5], v[0:1], v[0:1], -1.01918; SI-SDAG-NEXT: v_fma_f64 v[8:9], v[16:17], v[4:5], v[8:9]1919; SI-SDAG-NEXT: v_fma_f64 v[10:11], -v[8:9], v[8:9], v[2:3]1920; SI-SDAG-NEXT: v_rcp_f64_e32 v[12:13], v[6:7]1921; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[10:11], v[4:5], v[8:9]1922; SI-SDAG-NEXT: v_cndmask_b32_e32 v8, 0, v14, vcc1923; SI-SDAG-NEXT: v_ldexp_f64 v[4:5], v[4:5], v81924; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[2:3], v151925; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[6:7], v[12:13], 1.01926; SI-SDAG-NEXT: v_cndmask_b32_e32 v3, v5, v3, vcc1927; SI-SDAG-NEXT: v_cndmask_b32_e32 v2, v4, v2, vcc1928; SI-SDAG-NEXT: v_fma_f64 v[8:9], v[12:13], v[8:9], v[12:13]1929; SI-SDAG-NEXT: v_div_scale_f64 v[10:11], s[4:5], v[2:3], v[2:3], -1.01930; SI-SDAG-NEXT: v_fma_f64 v[4:5], -v[6:7], v[8:9], 1.01931; SI-SDAG-NEXT: v_div_scale_f64 v[12:13], s[4:5], -1.0, v[0:1], -1.01932; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[8:9], v[4:5], v[8:9]1933; SI-SDAG-NEXT: v_rcp_f64_e32 v[8:9], v[10:11]1934; SI-SDAG-NEXT: v_mul_f64 v[14:15], v[12:13], v[4:5]1935; SI-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, v1, v71936; SI-SDAG-NEXT: v_fma_f64 v[16:17], -v[6:7], v[14:15], v[12:13]1937; SI-SDAG-NEXT: v_fma_f64 v[18:19], -v[10:11], v[8:9], 1.01938; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[8:9], v[18:19], v[8:9]1939; SI-SDAG-NEXT: v_div_scale_f64 v[18:19], s[4:5], -1.0, v[2:3], -1.01940; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[10:11], v[6:7], 1.01941; SI-SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], s6, v131942; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]1943; SI-SDAG-NEXT: s_xor_b64 vcc, s[4:5], vcc1944; SI-SDAG-NEXT: v_mul_f64 v[8:9], v[18:19], v[6:7]1945; SI-SDAG-NEXT: v_div_fmas_f64 v[4:5], v[16:17], v[4:5], v[14:15]1946; SI-SDAG-NEXT: v_fma_f64 v[12:13], -v[10:11], v[8:9], v[18:19]1947; SI-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, v3, v111948; SI-SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], s6, v191949; SI-SDAG-NEXT: s_xor_b64 vcc, s[4:5], vcc1950; SI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[4:5], v[0:1], -1.01951; SI-SDAG-NEXT: s_nop 01952; SI-SDAG-NEXT: v_div_fmas_f64 v[6:7], v[12:13], v[6:7], v[8:9]1953; SI-SDAG-NEXT: v_div_fixup_f64 v[2:3], v[6:7], v[2:3], -1.01954; SI-SDAG-NEXT: s_setpc_b64 s[30:31]1955;1956; SI-GISEL-LABEL: v_neg_rsq_v2f64:1957; SI-GISEL: ; %bb.0:1958; SI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)1959; SI-GISEL-NEXT: v_mov_b32_e32 v4, 01960; SI-GISEL-NEXT: v_bfrev_b32_e32 v5, 81961; SI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[4:5]1962; SI-GISEL-NEXT: v_cmp_lt_f64_e64 s[4:5], v[2:3], v[4:5]1963; SI-GISEL-NEXT: v_cndmask_b32_e64 v6, 0, 1, vcc1964; SI-GISEL-NEXT: v_lshlrev_b32_e32 v6, 8, v61965; SI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v61966; SI-GISEL-NEXT: v_cndmask_b32_e64 v12, 0, 1, s[4:5]1967; SI-GISEL-NEXT: v_rsq_f64_e32 v[6:7], v[0:1]1968; SI-GISEL-NEXT: v_mov_b32_e32 v14, 0xffffff801969; SI-GISEL-NEXT: v_mov_b32_e32 v15, 0x2601970; SI-GISEL-NEXT: v_mov_b32_e32 v18, 0xbff000001971; SI-GISEL-NEXT: v_mul_f64 v[8:9], v[6:7], 0.51972; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[0:1], v[6:7]1973; SI-GISEL-NEXT: v_fma_f64 v[10:11], -v[8:9], v[6:7], 0.51974; SI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[10:11], v[6:7]1975; SI-GISEL-NEXT: v_fma_f64 v[8:9], v[8:9], v[10:11], v[8:9]1976; SI-GISEL-NEXT: v_fma_f64 v[10:11], -v[6:7], v[6:7], v[0:1]1977; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[10:11], v[8:9], v[6:7]1978; SI-GISEL-NEXT: v_lshlrev_b32_e32 v10, 8, v121979; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]1980; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v101981; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[6:7], v[8:9], v[4:5]1982; SI-GISEL-NEXT: v_rsq_f64_e32 v[6:7], v[2:3]1983; SI-GISEL-NEXT: v_cndmask_b32_e32 v8, 0, v14, vcc1984; SI-GISEL-NEXT: v_ldexp_f64 v[4:5], v[4:5], v81985; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v151986; SI-GISEL-NEXT: v_mul_f64 v[8:9], v[6:7], 0.51987; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[2:3], v[6:7]1988; SI-GISEL-NEXT: v_cndmask_b32_e32 v0, v4, v0, vcc1989; SI-GISEL-NEXT: v_fma_f64 v[10:11], -v[8:9], v[6:7], 0.51990; SI-GISEL-NEXT: v_cndmask_b32_e32 v1, v5, v1, vcc1991; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[6:7], v[10:11], v[6:7]1992; SI-GISEL-NEXT: v_fma_f64 v[6:7], v[8:9], v[10:11], v[8:9]1993; SI-GISEL-NEXT: v_fma_f64 v[8:9], -v[4:5], v[4:5], v[2:3]1994; SI-GISEL-NEXT: v_div_scale_f64 v[10:11], s[6:7], v[0:1], v[0:1], -1.01995; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[8:9], v[6:7], v[4:5]1996; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[2:3], v151997; SI-GISEL-NEXT: v_fma_f64 v[8:9], -v[4:5], v[4:5], v[2:3]1998; SI-GISEL-NEXT: v_rcp_f64_e32 v[12:13], v[10:11]1999; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[8:9], v[6:7], v[4:5]2000; SI-GISEL-NEXT: v_cndmask_b32_e64 v6, 0, v14, s[4:5]2001; SI-GISEL-NEXT: v_ldexp_f64 v[4:5], v[4:5], v62002; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[10:11], v[12:13], 1.02003; SI-GISEL-NEXT: v_cndmask_b32_e32 v2, v4, v2, vcc2004; SI-GISEL-NEXT: v_cndmask_b32_e32 v3, v5, v3, vcc2005; SI-GISEL-NEXT: v_fma_f64 v[6:7], v[12:13], v[6:7], v[12:13]2006; SI-GISEL-NEXT: v_div_scale_f64 v[8:9], s[4:5], v[2:3], v[2:3], -1.02007; SI-GISEL-NEXT: v_fma_f64 v[4:5], -v[10:11], v[6:7], 1.02008; SI-GISEL-NEXT: v_div_scale_f64 v[12:13], s[4:5], -1.0, v[0:1], -1.02009; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[6:7], v[4:5], v[6:7]2010; SI-GISEL-NEXT: v_rcp_f64_e32 v[6:7], v[8:9]2011; SI-GISEL-NEXT: v_mul_f64 v[14:15], v[12:13], v[4:5]2012; SI-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v13, v182013; SI-GISEL-NEXT: v_fma_f64 v[12:13], -v[10:11], v[14:15], v[12:13]2014; SI-GISEL-NEXT: v_fma_f64 v[16:17], -v[8:9], v[6:7], 1.02015; SI-GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], v1, v112016; SI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[16:17], v[6:7]2017; SI-GISEL-NEXT: v_div_scale_f64 v[16:17], s[6:7], -1.0, v[2:3], -1.02018; SI-GISEL-NEXT: v_fma_f64 v[10:11], -v[8:9], v[6:7], 1.02019; SI-GISEL-NEXT: s_xor_b64 vcc, vcc, s[4:5]2020; SI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[10:11], v[6:7]2021; SI-GISEL-NEXT: v_div_fmas_f64 v[4:5], v[12:13], v[4:5], v[14:15]2022; SI-GISEL-NEXT: v_mul_f64 v[10:11], v[16:17], v[6:7]2023; SI-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v17, v182024; SI-GISEL-NEXT: v_fma_f64 v[12:13], -v[8:9], v[10:11], v[16:17]2025; SI-GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], v3, v92026; SI-GISEL-NEXT: s_xor_b64 vcc, vcc, s[4:5]2027; SI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[4:5], v[0:1], -1.02028; SI-GISEL-NEXT: v_div_fmas_f64 v[6:7], v[12:13], v[6:7], v[10:11]2029; SI-GISEL-NEXT: v_div_fixup_f64 v[2:3], v[6:7], v[2:3], -1.02030; SI-GISEL-NEXT: s_setpc_b64 s[30:31]2031;2032; VI-SDAG-LABEL: v_neg_rsq_v2f64:2033; VI-SDAG: ; %bb.0:2034; VI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)2035; VI-SDAG-NEXT: s_mov_b32 s4, 02036; VI-SDAG-NEXT: s_brev_b32 s5, 82037; VI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[2:3]2038; VI-SDAG-NEXT: v_cmp_gt_f64_e64 s[4:5], s[4:5], v[0:1]2039; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0x1002040; VI-SDAG-NEXT: v_cndmask_b32_e32 v5, 0, v4, vcc2041; VI-SDAG-NEXT: v_cndmask_b32_e64 v4, 0, v4, s[4:5]2042; VI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v42043; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v52044; VI-SDAG-NEXT: v_rsq_f64_e32 v[6:7], v[0:1]2045; VI-SDAG-NEXT: v_rsq_f64_e32 v[4:5], v[2:3]2046; VI-SDAG-NEXT: v_mul_f64 v[10:11], v[0:1], v[6:7]2047; VI-SDAG-NEXT: v_mul_f64 v[6:7], v[6:7], 0.52048; VI-SDAG-NEXT: v_mul_f64 v[8:9], v[2:3], v[4:5]2049; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[4:5], 0.52050; VI-SDAG-NEXT: v_fma_f64 v[14:15], -v[6:7], v[10:11], 0.52051; VI-SDAG-NEXT: v_fma_f64 v[12:13], -v[4:5], v[8:9], 0.52052; VI-SDAG-NEXT: v_fma_f64 v[10:11], v[10:11], v[14:15], v[10:11]2053; VI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[14:15], v[6:7]2054; VI-SDAG-NEXT: v_fma_f64 v[8:9], v[8:9], v[12:13], v[8:9]2055; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[12:13], v[4:5]2056; VI-SDAG-NEXT: v_fma_f64 v[14:15], -v[10:11], v[10:11], v[0:1]2057; VI-SDAG-NEXT: v_fma_f64 v[12:13], -v[8:9], v[8:9], v[2:3]2058; VI-SDAG-NEXT: v_fma_f64 v[10:11], v[14:15], v[6:7], v[10:11]2059; VI-SDAG-NEXT: v_fma_f64 v[8:9], v[12:13], v[4:5], v[8:9]2060; VI-SDAG-NEXT: v_fma_f64 v[14:15], -v[10:11], v[10:11], v[0:1]2061; VI-SDAG-NEXT: v_fma_f64 v[12:13], -v[8:9], v[8:9], v[2:3]2062; VI-SDAG-NEXT: v_fma_f64 v[6:7], v[14:15], v[6:7], v[10:11]2063; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[12:13], v[4:5], v[8:9]2064; VI-SDAG-NEXT: v_mov_b32_e32 v8, 0xffffff802065; VI-SDAG-NEXT: v_mov_b32_e32 v9, 0x2602066; VI-SDAG-NEXT: v_cndmask_b32_e32 v10, 0, v8, vcc2067; VI-SDAG-NEXT: v_cndmask_b32_e64 v8, 0, v8, s[4:5]2068; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v92069; VI-SDAG-NEXT: v_ldexp_f64 v[6:7], v[6:7], v82070; VI-SDAG-NEXT: v_cmp_class_f64_e64 s[4:5], v[2:3], v92071; VI-SDAG-NEXT: v_ldexp_f64 v[4:5], v[4:5], v102072; VI-SDAG-NEXT: v_cndmask_b32_e32 v1, v7, v1, vcc2073; VI-SDAG-NEXT: v_cndmask_b32_e32 v0, v6, v0, vcc2074; VI-SDAG-NEXT: v_cndmask_b32_e64 v3, v5, v3, s[4:5]2075; VI-SDAG-NEXT: v_div_scale_f64 v[5:6], s[6:7], v[0:1], v[0:1], -1.02076; VI-SDAG-NEXT: v_cndmask_b32_e64 v2, v4, v2, s[4:5]2077; VI-SDAG-NEXT: v_div_scale_f64 v[7:8], s[4:5], v[2:3], v[2:3], -1.02078; VI-SDAG-NEXT: v_div_scale_f64 v[17:18], s[4:5], -1.0, v[2:3], -1.02079; VI-SDAG-NEXT: v_rcp_f64_e32 v[9:10], v[5:6]2080; VI-SDAG-NEXT: v_rcp_f64_e32 v[11:12], v[7:8]2081; VI-SDAG-NEXT: v_fma_f64 v[13:14], -v[5:6], v[9:10], 1.02082; VI-SDAG-NEXT: v_fma_f64 v[15:16], -v[7:8], v[11:12], 1.02083; VI-SDAG-NEXT: v_fma_f64 v[9:10], v[9:10], v[13:14], v[9:10]2084; VI-SDAG-NEXT: v_div_scale_f64 v[13:14], vcc, -1.0, v[0:1], -1.02085; VI-SDAG-NEXT: v_fma_f64 v[11:12], v[11:12], v[15:16], v[11:12]2086; VI-SDAG-NEXT: v_fma_f64 v[15:16], -v[5:6], v[9:10], 1.02087; VI-SDAG-NEXT: v_fma_f64 v[19:20], -v[7:8], v[11:12], 1.02088; VI-SDAG-NEXT: v_fma_f64 v[9:10], v[9:10], v[15:16], v[9:10]2089; VI-SDAG-NEXT: v_fma_f64 v[11:12], v[11:12], v[19:20], v[11:12]2090; VI-SDAG-NEXT: v_mul_f64 v[15:16], v[13:14], v[9:10]2091; VI-SDAG-NEXT: v_mul_f64 v[19:20], v[17:18], v[11:12]2092; VI-SDAG-NEXT: v_fma_f64 v[4:5], -v[5:6], v[15:16], v[13:14]2093; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[7:8], v[19:20], v[17:18]2094; VI-SDAG-NEXT: v_div_fmas_f64 v[4:5], v[4:5], v[9:10], v[15:16]2095; VI-SDAG-NEXT: s_mov_b64 vcc, s[4:5]2096; VI-SDAG-NEXT: v_div_fmas_f64 v[6:7], v[6:7], v[11:12], v[19:20]2097; VI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[4:5], v[0:1], -1.02098; VI-SDAG-NEXT: v_div_fixup_f64 v[2:3], v[6:7], v[2:3], -1.02099; VI-SDAG-NEXT: s_setpc_b64 s[30:31]2100;2101; VI-GISEL-LABEL: v_neg_rsq_v2f64:2102; VI-GISEL: ; %bb.0:2103; VI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)2104; VI-GISEL-NEXT: v_mov_b32_e32 v4, 02105; VI-GISEL-NEXT: v_bfrev_b32_e32 v5, 82106; VI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[4:5]2107; VI-GISEL-NEXT: v_cmp_lt_f64_e64 s[4:5], v[2:3], v[4:5]2108; VI-GISEL-NEXT: v_cndmask_b32_e64 v6, 0, 1, vcc2109; VI-GISEL-NEXT: v_lshlrev_b32_e32 v6, 8, v62110; VI-GISEL-NEXT: v_cndmask_b32_e64 v4, 0, 1, s[4:5]2111; VI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v62112; VI-GISEL-NEXT: v_lshlrev_b32_e32 v4, 8, v42113; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v42114; VI-GISEL-NEXT: v_rsq_f64_e32 v[4:5], v[0:1]2115; VI-GISEL-NEXT: v_rsq_f64_e32 v[6:7], v[2:3]2116; VI-GISEL-NEXT: v_mul_f64 v[8:9], v[4:5], 0.52117; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[0:1], v[4:5]2118; VI-GISEL-NEXT: v_mul_f64 v[10:11], v[6:7], 0.52119; VI-GISEL-NEXT: v_mul_f64 v[6:7], v[2:3], v[6:7]2120; VI-GISEL-NEXT: v_fma_f64 v[12:13], -v[8:9], v[4:5], 0.52121; VI-GISEL-NEXT: v_fma_f64 v[14:15], -v[10:11], v[6:7], 0.52122; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[12:13], v[4:5]2123; VI-GISEL-NEXT: v_fma_f64 v[8:9], v[8:9], v[12:13], v[8:9]2124; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[14:15], v[6:7]2125; VI-GISEL-NEXT: v_fma_f64 v[10:11], v[10:11], v[14:15], v[10:11]2126; VI-GISEL-NEXT: v_fma_f64 v[12:13], -v[4:5], v[4:5], v[0:1]2127; VI-GISEL-NEXT: v_fma_f64 v[14:15], -v[6:7], v[6:7], v[2:3]2128; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[12:13], v[8:9], v[4:5]2129; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[14:15], v[10:11], v[6:7]2130; VI-GISEL-NEXT: v_fma_f64 v[12:13], -v[4:5], v[4:5], v[0:1]2131; VI-GISEL-NEXT: v_fma_f64 v[14:15], -v[6:7], v[6:7], v[2:3]2132; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[12:13], v[8:9], v[4:5]2133; VI-GISEL-NEXT: v_mov_b32_e32 v8, 0xffffff802134; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[14:15], v[10:11], v[6:7]2135; VI-GISEL-NEXT: v_mov_b32_e32 v9, 0x2602136; VI-GISEL-NEXT: v_cndmask_b32_e32 v10, 0, v8, vcc2137; VI-GISEL-NEXT: v_cndmask_b32_e64 v8, 0, v8, s[4:5]2138; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v92139; VI-GISEL-NEXT: v_cmp_class_f64_e64 s[4:5], v[2:3], v92140; VI-GISEL-NEXT: v_ldexp_f64 v[4:5], v[4:5], v102141; VI-GISEL-NEXT: v_ldexp_f64 v[6:7], v[6:7], v82142; VI-GISEL-NEXT: v_cndmask_b32_e32 v0, v4, v0, vcc2143; VI-GISEL-NEXT: v_cndmask_b32_e32 v1, v5, v1, vcc2144; VI-GISEL-NEXT: v_cndmask_b32_e64 v2, v6, v2, s[4:5]2145; VI-GISEL-NEXT: v_div_scale_f64 v[4:5], s[6:7], v[0:1], v[0:1], -1.02146; VI-GISEL-NEXT: v_cndmask_b32_e64 v3, v7, v3, s[4:5]2147; VI-GISEL-NEXT: v_div_scale_f64 v[6:7], s[4:5], v[2:3], v[2:3], -1.02148; VI-GISEL-NEXT: v_div_scale_f64 v[16:17], s[4:5], -1.0, v[2:3], -1.02149; VI-GISEL-NEXT: v_rcp_f64_e32 v[8:9], v[4:5]2150; VI-GISEL-NEXT: v_rcp_f64_e32 v[10:11], v[6:7]2151; VI-GISEL-NEXT: v_fma_f64 v[12:13], -v[4:5], v[8:9], 1.02152; VI-GISEL-NEXT: v_fma_f64 v[14:15], -v[6:7], v[10:11], 1.02153; VI-GISEL-NEXT: v_fma_f64 v[8:9], v[8:9], v[12:13], v[8:9]2154; VI-GISEL-NEXT: v_div_scale_f64 v[12:13], vcc, -1.0, v[0:1], -1.02155; VI-GISEL-NEXT: v_fma_f64 v[10:11], v[10:11], v[14:15], v[10:11]2156; VI-GISEL-NEXT: v_fma_f64 v[14:15], -v[4:5], v[8:9], 1.02157; VI-GISEL-NEXT: v_fma_f64 v[18:19], -v[6:7], v[10:11], 1.02158; VI-GISEL-NEXT: v_fma_f64 v[8:9], v[8:9], v[14:15], v[8:9]2159; VI-GISEL-NEXT: v_fma_f64 v[10:11], v[10:11], v[18:19], v[10:11]2160; VI-GISEL-NEXT: v_mul_f64 v[14:15], v[12:13], v[8:9]2161; VI-GISEL-NEXT: v_mul_f64 v[18:19], v[16:17], v[10:11]2162; VI-GISEL-NEXT: v_fma_f64 v[4:5], -v[4:5], v[14:15], v[12:13]2163; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[6:7], v[18:19], v[16:17]2164; VI-GISEL-NEXT: v_div_fmas_f64 v[4:5], v[4:5], v[8:9], v[14:15]2165; VI-GISEL-NEXT: s_mov_b64 vcc, s[4:5]2166; VI-GISEL-NEXT: v_div_fmas_f64 v[6:7], v[6:7], v[10:11], v[18:19]2167; VI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[4:5], v[0:1], -1.02168; VI-GISEL-NEXT: v_div_fixup_f64 v[2:3], v[6:7], v[2:3], -1.02169; VI-GISEL-NEXT: s_setpc_b64 s[30:31]2170 %sqrt = call <2 x double> @llvm.sqrt.v2f64(<2 x double> %x)2171 %rsq = fdiv <2 x double> <double -1.0, double -1.0>, %sqrt2172 ret <2 x double> %rsq2173}2174 2175define <2 x double> @v_neg_rsq_v2f64_poisonelt(<2 x double> %x) {2176; SI-SDAG-LABEL: v_neg_rsq_v2f64_poisonelt:2177; SI-SDAG: ; %bb.0:2178; SI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)2179; SI-SDAG-NEXT: s_mov_b32 s4, 02180; SI-SDAG-NEXT: s_brev_b32 s5, 82181; SI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]2182; SI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1002183; SI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc2184; SI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v22185; SI-SDAG-NEXT: v_mov_b32_e32 v8, 0xffffff802186; SI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]2187; SI-SDAG-NEXT: v_mov_b32_e32 v9, 0x2602188; SI-SDAG-NEXT: s_mov_b32 s6, 0xbff000002189; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]2190; SI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.52191; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.52192; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]2193; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]2194; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]2195; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]2196; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]2197; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]2198; SI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc2199; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v42200; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v92201; SI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc2202; SI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc2203; SI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], -1.02204; SI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]2205; SI-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, v1, v32206; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.02207; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]2208; SI-SDAG-NEXT: v_div_scale_f64 v[6:7], s[4:5], -1.0, v[0:1], -1.02209; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.02210; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]2211; SI-SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], s6, v72212; SI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]2213; SI-SDAG-NEXT: s_xor_b64 vcc, s[4:5], vcc2214; SI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]2215; SI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]2216; SI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], -1.02217; SI-SDAG-NEXT: v_mov_b32_e32 v2, 02218; SI-SDAG-NEXT: v_mov_b32_e32 v3, 0x7ff800002219; SI-SDAG-NEXT: s_setpc_b64 s[30:31]2220;2221; SI-GISEL-LABEL: v_neg_rsq_v2f64_poisonelt:2222; SI-GISEL: ; %bb.0:2223; SI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)2224; SI-GISEL-NEXT: v_mov_b32_e32 v4, 02225; SI-GISEL-NEXT: v_bfrev_b32_e32 v5, 82226; SI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[4:5]2227; SI-GISEL-NEXT: v_cmp_lt_f64_e64 s[4:5], v[2:3], v[4:5]2228; SI-GISEL-NEXT: v_cndmask_b32_e64 v6, 0, 1, vcc2229; SI-GISEL-NEXT: v_lshlrev_b32_e32 v6, 8, v62230; SI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v62231; SI-GISEL-NEXT: v_cndmask_b32_e64 v12, 0, 1, s[4:5]2232; SI-GISEL-NEXT: v_rsq_f64_e32 v[6:7], v[0:1]2233; SI-GISEL-NEXT: v_mul_f64 v[8:9], v[6:7], 0.52234; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[0:1], v[6:7]2235; SI-GISEL-NEXT: v_fma_f64 v[10:11], -v[8:9], v[6:7], 0.52236; SI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[10:11], v[6:7]2237; SI-GISEL-NEXT: v_fma_f64 v[8:9], v[8:9], v[10:11], v[8:9]2238; SI-GISEL-NEXT: v_fma_f64 v[10:11], -v[6:7], v[6:7], v[0:1]2239; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[10:11], v[8:9], v[6:7]2240; SI-GISEL-NEXT: v_lshlrev_b32_e32 v6, 8, v122241; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v62242; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]2243; SI-GISEL-NEXT: v_rsq_f64_e32 v[10:11], v[2:3]2244; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[6:7], v[8:9], v[4:5]2245; SI-GISEL-NEXT: v_mov_b32_e32 v12, 0xffffff802246; SI-GISEL-NEXT: v_cndmask_b32_e32 v13, 0, v12, vcc2247; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[10:11], 0.52248; SI-GISEL-NEXT: v_mul_f64 v[8:9], v[2:3], v[10:11]2249; SI-GISEL-NEXT: v_ldexp_f64 v[4:5], v[4:5], v132250; SI-GISEL-NEXT: v_fma_f64 v[10:11], -v[6:7], v[8:9], 0.52251; SI-GISEL-NEXT: v_mov_b32_e32 v13, 0x2602252; SI-GISEL-NEXT: v_fma_f64 v[8:9], v[8:9], v[10:11], v[8:9]2253; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v132254; SI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[10:11], v[6:7]2255; SI-GISEL-NEXT: v_fma_f64 v[10:11], -v[8:9], v[8:9], v[2:3]2256; SI-GISEL-NEXT: v_cndmask_b32_e32 v0, v4, v0, vcc2257; SI-GISEL-NEXT: v_cndmask_b32_e32 v1, v5, v1, vcc2258; SI-GISEL-NEXT: v_fma_f64 v[8:9], v[10:11], v[6:7], v[8:9]2259; SI-GISEL-NEXT: v_div_scale_f64 v[10:11], s[6:7], v[0:1], v[0:1], -1.02260; SI-GISEL-NEXT: v_fma_f64 v[4:5], -v[8:9], v[8:9], v[2:3]2261; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[2:3], v132262; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[8:9]2263; SI-GISEL-NEXT: v_rcp_f64_e32 v[6:7], v[10:11]2264; SI-GISEL-NEXT: v_cndmask_b32_e64 v8, 0, v12, s[4:5]2265; SI-GISEL-NEXT: v_ldexp_f64 v[4:5], v[4:5], v82266; SI-GISEL-NEXT: v_fma_f64 v[8:9], -v[10:11], v[6:7], 1.02267; SI-GISEL-NEXT: v_cndmask_b32_e32 v2, v4, v2, vcc2268; SI-GISEL-NEXT: v_cndmask_b32_e32 v3, v5, v3, vcc2269; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[6:7], v[8:9], v[6:7]2270; SI-GISEL-NEXT: v_div_scale_f64 v[6:7], s[4:5], v[2:3], v[2:3], s[4:5]2271; SI-GISEL-NEXT: v_fma_f64 v[8:9], -v[10:11], v[4:5], 1.02272; SI-GISEL-NEXT: v_div_scale_f64 v[12:13], s[4:5], -1.0, v[0:1], -1.02273; SI-GISEL-NEXT: v_rcp_f64_e32 v[14:15], v[6:7]2274; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]2275; SI-GISEL-NEXT: v_mul_f64 v[8:9], v[12:13], v[4:5]2276; SI-GISEL-NEXT: v_fma_f64 v[16:17], -v[6:7], v[14:15], 1.02277; SI-GISEL-NEXT: v_fma_f64 v[18:19], -v[10:11], v[8:9], v[12:13]2278; SI-GISEL-NEXT: v_fma_f64 v[14:15], v[14:15], v[16:17], v[14:15]2279; SI-GISEL-NEXT: v_mov_b32_e32 v10, 0xbff000002280; SI-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v13, v102281; SI-GISEL-NEXT: v_fma_f64 v[12:13], -v[6:7], v[14:15], 1.02282; SI-GISEL-NEXT: v_div_scale_f64 v[16:17], s[4:5], s[4:5], v[2:3], s[4:5]2283; SI-GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], v1, v112284; SI-GISEL-NEXT: v_fma_f64 v[10:11], v[14:15], v[12:13], v[14:15]2285; SI-GISEL-NEXT: s_xor_b64 vcc, vcc, s[4:5]2286; SI-GISEL-NEXT: v_mul_f64 v[12:13], v[16:17], v[10:11]2287; SI-GISEL-NEXT: v_div_fmas_f64 v[4:5], v[18:19], v[4:5], v[8:9]2288; SI-GISEL-NEXT: v_fma_f64 v[8:9], -v[6:7], v[12:13], v[16:17]2289; SI-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, s4, v172290; SI-GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], v3, v72291; SI-GISEL-NEXT: s_xor_b64 vcc, vcc, s[4:5]2292; SI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[4:5], v[0:1], -1.02293; SI-GISEL-NEXT: s_nop 02294; SI-GISEL-NEXT: v_div_fmas_f64 v[6:7], v[8:9], v[10:11], v[12:13]2295; SI-GISEL-NEXT: v_div_fixup_f64 v[2:3], v[6:7], v[2:3], s[4:5]2296; SI-GISEL-NEXT: s_setpc_b64 s[30:31]2297;2298; VI-SDAG-LABEL: v_neg_rsq_v2f64_poisonelt:2299; VI-SDAG: ; %bb.0:2300; VI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)2301; VI-SDAG-NEXT: s_mov_b32 s4, 02302; VI-SDAG-NEXT: s_brev_b32 s5, 82303; VI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]2304; VI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1002305; VI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc2306; VI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v22307; VI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]2308; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]2309; VI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.52310; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.52311; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]2312; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]2313; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]2314; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]2315; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]2316; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]2317; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0xffffff802318; VI-SDAG-NEXT: v_mov_b32_e32 v5, 0x2602319; VI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc2320; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v52321; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v42322; VI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc2323; VI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc2324; VI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], -1.02325; VI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]2326; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.02327; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]2328; VI-SDAG-NEXT: v_div_scale_f64 v[6:7], vcc, -1.0, v[0:1], -1.02329; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.02330; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]2331; VI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]2332; VI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]2333; VI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]2334; VI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], -1.02335; VI-SDAG-NEXT: v_mov_b32_e32 v2, 02336; VI-SDAG-NEXT: v_mov_b32_e32 v3, 0x7ff800002337; VI-SDAG-NEXT: s_setpc_b64 s[30:31]2338;2339; VI-GISEL-LABEL: v_neg_rsq_v2f64_poisonelt:2340; VI-GISEL: ; %bb.0:2341; VI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)2342; VI-GISEL-NEXT: v_mov_b32_e32 v4, 02343; VI-GISEL-NEXT: v_bfrev_b32_e32 v5, 82344; VI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[4:5]2345; VI-GISEL-NEXT: v_cmp_lt_f64_e64 s[4:5], v[2:3], v[4:5]2346; VI-GISEL-NEXT: v_cndmask_b32_e64 v6, 0, 1, vcc2347; VI-GISEL-NEXT: v_lshlrev_b32_e32 v6, 8, v62348; VI-GISEL-NEXT: v_cndmask_b32_e64 v4, 0, 1, s[4:5]2349; VI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v62350; VI-GISEL-NEXT: v_lshlrev_b32_e32 v4, 8, v42351; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v42352; VI-GISEL-NEXT: v_rsq_f64_e32 v[4:5], v[0:1]2353; VI-GISEL-NEXT: v_rsq_f64_e32 v[6:7], v[2:3]2354; VI-GISEL-NEXT: v_mul_f64 v[8:9], v[4:5], 0.52355; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[0:1], v[4:5]2356; VI-GISEL-NEXT: v_mul_f64 v[10:11], v[6:7], 0.52357; VI-GISEL-NEXT: v_mul_f64 v[6:7], v[2:3], v[6:7]2358; VI-GISEL-NEXT: v_fma_f64 v[12:13], -v[8:9], v[4:5], 0.52359; VI-GISEL-NEXT: v_fma_f64 v[14:15], -v[10:11], v[6:7], 0.52360; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[12:13], v[4:5]2361; VI-GISEL-NEXT: v_fma_f64 v[8:9], v[8:9], v[12:13], v[8:9]2362; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[14:15], v[6:7]2363; VI-GISEL-NEXT: v_fma_f64 v[10:11], v[10:11], v[14:15], v[10:11]2364; VI-GISEL-NEXT: v_fma_f64 v[12:13], -v[4:5], v[4:5], v[0:1]2365; VI-GISEL-NEXT: v_fma_f64 v[14:15], -v[6:7], v[6:7], v[2:3]2366; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[12:13], v[8:9], v[4:5]2367; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[14:15], v[10:11], v[6:7]2368; VI-GISEL-NEXT: v_fma_f64 v[12:13], -v[4:5], v[4:5], v[0:1]2369; VI-GISEL-NEXT: v_fma_f64 v[14:15], -v[6:7], v[6:7], v[2:3]2370; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[12:13], v[8:9], v[4:5]2371; VI-GISEL-NEXT: v_mov_b32_e32 v8, 0xffffff802372; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[14:15], v[10:11], v[6:7]2373; VI-GISEL-NEXT: v_mov_b32_e32 v9, 0x2602374; VI-GISEL-NEXT: v_cndmask_b32_e32 v10, 0, v8, vcc2375; VI-GISEL-NEXT: v_cndmask_b32_e64 v8, 0, v8, s[4:5]2376; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v92377; VI-GISEL-NEXT: v_cmp_class_f64_e64 s[4:5], v[2:3], v92378; VI-GISEL-NEXT: v_ldexp_f64 v[4:5], v[4:5], v102379; VI-GISEL-NEXT: v_ldexp_f64 v[6:7], v[6:7], v82380; VI-GISEL-NEXT: v_cndmask_b32_e32 v0, v4, v0, vcc2381; VI-GISEL-NEXT: v_cndmask_b32_e32 v1, v5, v1, vcc2382; VI-GISEL-NEXT: v_cndmask_b32_e64 v2, v6, v2, s[4:5]2383; VI-GISEL-NEXT: v_div_scale_f64 v[4:5], s[6:7], v[0:1], v[0:1], -1.02384; VI-GISEL-NEXT: v_cndmask_b32_e64 v3, v7, v3, s[4:5]2385; VI-GISEL-NEXT: v_div_scale_f64 v[6:7], s[4:5], v[2:3], v[2:3], s[4:5]2386; VI-GISEL-NEXT: v_div_scale_f64 v[16:17], s[4:5], s[4:5], v[2:3], s[4:5]2387; VI-GISEL-NEXT: v_rcp_f64_e32 v[8:9], v[4:5]2388; VI-GISEL-NEXT: v_rcp_f64_e32 v[10:11], v[6:7]2389; VI-GISEL-NEXT: v_fma_f64 v[12:13], -v[4:5], v[8:9], 1.02390; VI-GISEL-NEXT: v_fma_f64 v[14:15], -v[6:7], v[10:11], 1.02391; VI-GISEL-NEXT: v_fma_f64 v[8:9], v[8:9], v[12:13], v[8:9]2392; VI-GISEL-NEXT: v_div_scale_f64 v[12:13], vcc, -1.0, v[0:1], -1.02393; VI-GISEL-NEXT: v_fma_f64 v[10:11], v[10:11], v[14:15], v[10:11]2394; VI-GISEL-NEXT: v_fma_f64 v[14:15], -v[4:5], v[8:9], 1.02395; VI-GISEL-NEXT: v_fma_f64 v[18:19], -v[6:7], v[10:11], 1.02396; VI-GISEL-NEXT: v_fma_f64 v[8:9], v[8:9], v[14:15], v[8:9]2397; VI-GISEL-NEXT: v_fma_f64 v[10:11], v[10:11], v[18:19], v[10:11]2398; VI-GISEL-NEXT: v_mul_f64 v[14:15], v[12:13], v[8:9]2399; VI-GISEL-NEXT: v_mul_f64 v[18:19], v[16:17], v[10:11]2400; VI-GISEL-NEXT: v_fma_f64 v[4:5], -v[4:5], v[14:15], v[12:13]2401; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[6:7], v[18:19], v[16:17]2402; VI-GISEL-NEXT: v_div_fmas_f64 v[4:5], v[4:5], v[8:9], v[14:15]2403; VI-GISEL-NEXT: s_mov_b64 vcc, s[4:5]2404; VI-GISEL-NEXT: v_div_fmas_f64 v[6:7], v[6:7], v[10:11], v[18:19]2405; VI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[4:5], v[0:1], -1.02406; VI-GISEL-NEXT: v_div_fixup_f64 v[2:3], v[6:7], v[2:3], s[4:5]2407; VI-GISEL-NEXT: s_setpc_b64 s[30:31]2408 %sqrt = call <2 x double> @llvm.sqrt.v2f64(<2 x double> %x)2409 %rsq = fdiv <2 x double> <double -1.0, double poison>, %sqrt2410 ret <2 x double> %rsq2411}2412 2413define <2 x double> @v_neg_pos_rsq_v2f64(<2 x double> %x) {2414; SI-SDAG-LABEL: v_neg_pos_rsq_v2f64:2415; SI-SDAG: ; %bb.0:2416; SI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)2417; SI-SDAG-NEXT: s_mov_b32 s4, 02418; SI-SDAG-NEXT: s_brev_b32 s5, 82419; SI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[2:3]2420; SI-SDAG-NEXT: v_cmp_gt_f64_e64 s[4:5], s[4:5], v[0:1]2421; SI-SDAG-NEXT: v_mov_b32_e32 v6, 0x1002422; SI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v6, vcc2423; SI-SDAG-NEXT: v_cndmask_b32_e64 v6, 0, v6, s[4:5]2424; SI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v62425; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v42426; SI-SDAG-NEXT: v_rsq_f64_e32 v[6:7], v[0:1]2427; SI-SDAG-NEXT: v_rsq_f64_e32 v[4:5], v[2:3]2428; SI-SDAG-NEXT: s_mov_b32 s6, 0xbff000002429; SI-SDAG-NEXT: v_mul_f64 v[10:11], v[0:1], v[6:7]2430; SI-SDAG-NEXT: v_mul_f64 v[6:7], v[6:7], 0.52431; SI-SDAG-NEXT: v_mul_f64 v[8:9], v[2:3], v[4:5]2432; SI-SDAG-NEXT: v_fma_f64 v[14:15], -v[6:7], v[10:11], 0.52433; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[4:5], 0.52434; SI-SDAG-NEXT: v_fma_f64 v[10:11], v[10:11], v[14:15], v[10:11]2435; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[14:15], v[6:7]2436; SI-SDAG-NEXT: v_fma_f64 v[18:19], -v[10:11], v[10:11], v[0:1]2437; SI-SDAG-NEXT: v_fma_f64 v[12:13], -v[4:5], v[8:9], 0.52438; SI-SDAG-NEXT: v_fma_f64 v[10:11], v[18:19], v[6:7], v[10:11]2439; SI-SDAG-NEXT: v_fma_f64 v[8:9], v[8:9], v[12:13], v[8:9]2440; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[12:13], v[4:5]2441; SI-SDAG-NEXT: v_fma_f64 v[12:13], -v[10:11], v[10:11], v[0:1]2442; SI-SDAG-NEXT: v_mov_b32_e32 v14, 0xffffff802443; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[12:13], v[6:7], v[10:11]2444; SI-SDAG-NEXT: v_mov_b32_e32 v15, 0x2602445; SI-SDAG-NEXT: v_cndmask_b32_e64 v10, 0, v14, s[4:5]2446; SI-SDAG-NEXT: v_ldexp_f64 v[6:7], v[6:7], v102447; SI-SDAG-NEXT: v_cmp_class_f64_e64 s[4:5], v[0:1], v152448; SI-SDAG-NEXT: v_fma_f64 v[16:17], -v[8:9], v[8:9], v[2:3]2449; SI-SDAG-NEXT: v_cndmask_b32_e64 v1, v7, v1, s[4:5]2450; SI-SDAG-NEXT: v_cndmask_b32_e64 v0, v6, v0, s[4:5]2451; SI-SDAG-NEXT: v_div_scale_f64 v[6:7], s[4:5], v[0:1], v[0:1], -1.02452; SI-SDAG-NEXT: v_fma_f64 v[8:9], v[16:17], v[4:5], v[8:9]2453; SI-SDAG-NEXT: v_fma_f64 v[10:11], -v[8:9], v[8:9], v[2:3]2454; SI-SDAG-NEXT: v_rcp_f64_e32 v[12:13], v[6:7]2455; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[10:11], v[4:5], v[8:9]2456; SI-SDAG-NEXT: v_cndmask_b32_e32 v8, 0, v14, vcc2457; SI-SDAG-NEXT: v_ldexp_f64 v[4:5], v[4:5], v82458; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[2:3], v152459; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[6:7], v[12:13], 1.02460; SI-SDAG-NEXT: v_cndmask_b32_e32 v3, v5, v3, vcc2461; SI-SDAG-NEXT: v_cndmask_b32_e32 v2, v4, v2, vcc2462; SI-SDAG-NEXT: v_fma_f64 v[8:9], v[12:13], v[8:9], v[12:13]2463; SI-SDAG-NEXT: v_div_scale_f64 v[10:11], s[4:5], v[2:3], v[2:3], 1.02464; SI-SDAG-NEXT: v_fma_f64 v[4:5], -v[6:7], v[8:9], 1.02465; SI-SDAG-NEXT: v_div_scale_f64 v[12:13], s[4:5], -1.0, v[0:1], -1.02466; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[8:9], v[4:5], v[8:9]2467; SI-SDAG-NEXT: v_rcp_f64_e32 v[8:9], v[10:11]2468; SI-SDAG-NEXT: v_mul_f64 v[14:15], v[12:13], v[4:5]2469; SI-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, v1, v72470; SI-SDAG-NEXT: v_fma_f64 v[16:17], -v[6:7], v[14:15], v[12:13]2471; SI-SDAG-NEXT: v_fma_f64 v[18:19], -v[10:11], v[8:9], 1.02472; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[8:9], v[18:19], v[8:9]2473; SI-SDAG-NEXT: v_div_scale_f64 v[18:19], s[4:5], 1.0, v[2:3], 1.02474; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[10:11], v[6:7], 1.02475; SI-SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], s6, v132476; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]2477; SI-SDAG-NEXT: s_xor_b64 vcc, s[4:5], vcc2478; SI-SDAG-NEXT: v_mul_f64 v[8:9], v[18:19], v[6:7]2479; SI-SDAG-NEXT: s_mov_b32 s4, 0x3ff000002480; SI-SDAG-NEXT: v_div_fmas_f64 v[4:5], v[16:17], v[4:5], v[14:15]2481; SI-SDAG-NEXT: v_fma_f64 v[12:13], -v[10:11], v[8:9], v[18:19]2482; SI-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, v3, v112483; SI-SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], s4, v192484; SI-SDAG-NEXT: s_xor_b64 vcc, s[4:5], vcc2485; SI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[4:5], v[0:1], -1.02486; SI-SDAG-NEXT: s_nop 02487; SI-SDAG-NEXT: v_div_fmas_f64 v[6:7], v[12:13], v[6:7], v[8:9]2488; SI-SDAG-NEXT: v_div_fixup_f64 v[2:3], v[6:7], v[2:3], 1.02489; SI-SDAG-NEXT: s_setpc_b64 s[30:31]2490;2491; SI-GISEL-LABEL: v_neg_pos_rsq_v2f64:2492; SI-GISEL: ; %bb.0:2493; SI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)2494; SI-GISEL-NEXT: v_mov_b32_e32 v4, 02495; SI-GISEL-NEXT: v_bfrev_b32_e32 v5, 82496; SI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[4:5]2497; SI-GISEL-NEXT: v_cmp_lt_f64_e64 s[4:5], v[2:3], v[4:5]2498; SI-GISEL-NEXT: v_cndmask_b32_e64 v6, 0, 1, vcc2499; SI-GISEL-NEXT: v_lshlrev_b32_e32 v6, 8, v62500; SI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v62501; SI-GISEL-NEXT: v_cndmask_b32_e64 v12, 0, 1, s[4:5]2502; SI-GISEL-NEXT: v_rsq_f64_e32 v[6:7], v[0:1]2503; SI-GISEL-NEXT: v_mul_f64 v[8:9], v[6:7], 0.52504; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[0:1], v[6:7]2505; SI-GISEL-NEXT: v_fma_f64 v[10:11], -v[8:9], v[6:7], 0.52506; SI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[10:11], v[6:7]2507; SI-GISEL-NEXT: v_fma_f64 v[8:9], v[8:9], v[10:11], v[8:9]2508; SI-GISEL-NEXT: v_fma_f64 v[10:11], -v[6:7], v[6:7], v[0:1]2509; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[10:11], v[8:9], v[6:7]2510; SI-GISEL-NEXT: v_lshlrev_b32_e32 v6, 8, v122511; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v62512; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]2513; SI-GISEL-NEXT: v_rsq_f64_e32 v[10:11], v[2:3]2514; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[6:7], v[8:9], v[4:5]2515; SI-GISEL-NEXT: v_mov_b32_e32 v12, 0xffffff802516; SI-GISEL-NEXT: v_cndmask_b32_e32 v13, 0, v12, vcc2517; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[10:11], 0.52518; SI-GISEL-NEXT: v_mul_f64 v[8:9], v[2:3], v[10:11]2519; SI-GISEL-NEXT: v_ldexp_f64 v[4:5], v[4:5], v132520; SI-GISEL-NEXT: v_fma_f64 v[10:11], -v[6:7], v[8:9], 0.52521; SI-GISEL-NEXT: v_mov_b32_e32 v13, 0x2602522; SI-GISEL-NEXT: v_fma_f64 v[8:9], v[8:9], v[10:11], v[8:9]2523; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v132524; SI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[10:11], v[6:7]2525; SI-GISEL-NEXT: v_fma_f64 v[10:11], -v[8:9], v[8:9], v[2:3]2526; SI-GISEL-NEXT: v_cndmask_b32_e32 v0, v4, v0, vcc2527; SI-GISEL-NEXT: v_cndmask_b32_e32 v1, v5, v1, vcc2528; SI-GISEL-NEXT: v_fma_f64 v[8:9], v[10:11], v[6:7], v[8:9]2529; SI-GISEL-NEXT: v_div_scale_f64 v[10:11], s[6:7], v[0:1], v[0:1], -1.02530; SI-GISEL-NEXT: v_fma_f64 v[4:5], -v[8:9], v[8:9], v[2:3]2531; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[2:3], v132532; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[8:9]2533; SI-GISEL-NEXT: v_rcp_f64_e32 v[6:7], v[10:11]2534; SI-GISEL-NEXT: v_cndmask_b32_e64 v8, 0, v12, s[4:5]2535; SI-GISEL-NEXT: v_ldexp_f64 v[4:5], v[4:5], v82536; SI-GISEL-NEXT: v_div_scale_f64 v[12:13], s[4:5], -1.0, v[0:1], -1.02537; SI-GISEL-NEXT: v_fma_f64 v[8:9], -v[10:11], v[6:7], 1.02538; SI-GISEL-NEXT: v_cndmask_b32_e32 v2, v4, v2, vcc2539; SI-GISEL-NEXT: v_cndmask_b32_e32 v3, v5, v3, vcc2540; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[6:7], v[8:9], v[6:7]2541; SI-GISEL-NEXT: v_div_scale_f64 v[6:7], s[4:5], v[2:3], v[2:3], 1.02542; SI-GISEL-NEXT: v_fma_f64 v[8:9], -v[10:11], v[4:5], 1.02543; SI-GISEL-NEXT: v_rcp_f64_e32 v[14:15], v[6:7]2544; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]2545; SI-GISEL-NEXT: v_mul_f64 v[8:9], v[12:13], v[4:5]2546; SI-GISEL-NEXT: v_fma_f64 v[16:17], -v[6:7], v[14:15], 1.02547; SI-GISEL-NEXT: v_fma_f64 v[18:19], -v[10:11], v[8:9], v[12:13]2548; SI-GISEL-NEXT: v_fma_f64 v[14:15], v[14:15], v[16:17], v[14:15]2549; SI-GISEL-NEXT: v_mov_b32_e32 v10, 0xbff000002550; SI-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v13, v102551; SI-GISEL-NEXT: v_fma_f64 v[12:13], -v[6:7], v[14:15], 1.02552; SI-GISEL-NEXT: v_div_scale_f64 v[16:17], s[4:5], 1.0, v[2:3], 1.02553; SI-GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], v1, v112554; SI-GISEL-NEXT: v_fma_f64 v[10:11], v[14:15], v[12:13], v[14:15]2555; SI-GISEL-NEXT: s_xor_b64 vcc, vcc, s[4:5]2556; SI-GISEL-NEXT: v_mul_f64 v[12:13], v[16:17], v[10:11]2557; SI-GISEL-NEXT: v_div_fmas_f64 v[4:5], v[18:19], v[4:5], v[8:9]2558; SI-GISEL-NEXT: v_fma_f64 v[8:9], -v[6:7], v[12:13], v[16:17]2559; SI-GISEL-NEXT: v_mov_b32_e32 v6, 0x3ff000002560; SI-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v17, v62561; SI-GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], v3, v72562; SI-GISEL-NEXT: s_xor_b64 vcc, vcc, s[4:5]2563; SI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[4:5], v[0:1], -1.02564; SI-GISEL-NEXT: s_nop 02565; SI-GISEL-NEXT: v_div_fmas_f64 v[6:7], v[8:9], v[10:11], v[12:13]2566; SI-GISEL-NEXT: v_div_fixup_f64 v[2:3], v[6:7], v[2:3], 1.02567; SI-GISEL-NEXT: s_setpc_b64 s[30:31]2568;2569; VI-SDAG-LABEL: v_neg_pos_rsq_v2f64:2570; VI-SDAG: ; %bb.0:2571; VI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)2572; VI-SDAG-NEXT: s_mov_b32 s4, 02573; VI-SDAG-NEXT: s_brev_b32 s5, 82574; VI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[2:3]2575; VI-SDAG-NEXT: v_cmp_gt_f64_e64 s[4:5], s[4:5], v[0:1]2576; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0x1002577; VI-SDAG-NEXT: v_cndmask_b32_e32 v5, 0, v4, vcc2578; VI-SDAG-NEXT: v_cndmask_b32_e64 v4, 0, v4, s[4:5]2579; VI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v42580; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v52581; VI-SDAG-NEXT: v_rsq_f64_e32 v[6:7], v[0:1]2582; VI-SDAG-NEXT: v_rsq_f64_e32 v[4:5], v[2:3]2583; VI-SDAG-NEXT: v_mul_f64 v[10:11], v[0:1], v[6:7]2584; VI-SDAG-NEXT: v_mul_f64 v[6:7], v[6:7], 0.52585; VI-SDAG-NEXT: v_mul_f64 v[8:9], v[2:3], v[4:5]2586; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[4:5], 0.52587; VI-SDAG-NEXT: v_fma_f64 v[14:15], -v[6:7], v[10:11], 0.52588; VI-SDAG-NEXT: v_fma_f64 v[12:13], -v[4:5], v[8:9], 0.52589; VI-SDAG-NEXT: v_fma_f64 v[10:11], v[10:11], v[14:15], v[10:11]2590; VI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[14:15], v[6:7]2591; VI-SDAG-NEXT: v_fma_f64 v[8:9], v[8:9], v[12:13], v[8:9]2592; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[12:13], v[4:5]2593; VI-SDAG-NEXT: v_fma_f64 v[14:15], -v[10:11], v[10:11], v[0:1]2594; VI-SDAG-NEXT: v_fma_f64 v[12:13], -v[8:9], v[8:9], v[2:3]2595; VI-SDAG-NEXT: v_fma_f64 v[10:11], v[14:15], v[6:7], v[10:11]2596; VI-SDAG-NEXT: v_fma_f64 v[8:9], v[12:13], v[4:5], v[8:9]2597; VI-SDAG-NEXT: v_fma_f64 v[14:15], -v[10:11], v[10:11], v[0:1]2598; VI-SDAG-NEXT: v_fma_f64 v[12:13], -v[8:9], v[8:9], v[2:3]2599; VI-SDAG-NEXT: v_fma_f64 v[6:7], v[14:15], v[6:7], v[10:11]2600; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[12:13], v[4:5], v[8:9]2601; VI-SDAG-NEXT: v_mov_b32_e32 v8, 0xffffff802602; VI-SDAG-NEXT: v_mov_b32_e32 v9, 0x2602603; VI-SDAG-NEXT: v_cndmask_b32_e32 v10, 0, v8, vcc2604; VI-SDAG-NEXT: v_cndmask_b32_e64 v8, 0, v8, s[4:5]2605; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v92606; VI-SDAG-NEXT: v_ldexp_f64 v[6:7], v[6:7], v82607; VI-SDAG-NEXT: v_cmp_class_f64_e64 s[4:5], v[2:3], v92608; VI-SDAG-NEXT: v_ldexp_f64 v[4:5], v[4:5], v102609; VI-SDAG-NEXT: v_cndmask_b32_e32 v1, v7, v1, vcc2610; VI-SDAG-NEXT: v_cndmask_b32_e32 v0, v6, v0, vcc2611; VI-SDAG-NEXT: v_cndmask_b32_e64 v3, v5, v3, s[4:5]2612; VI-SDAG-NEXT: v_div_scale_f64 v[5:6], s[6:7], v[0:1], v[0:1], -1.02613; VI-SDAG-NEXT: v_cndmask_b32_e64 v2, v4, v2, s[4:5]2614; VI-SDAG-NEXT: v_div_scale_f64 v[7:8], s[4:5], v[2:3], v[2:3], 1.02615; VI-SDAG-NEXT: v_div_scale_f64 v[17:18], s[4:5], 1.0, v[2:3], 1.02616; VI-SDAG-NEXT: v_rcp_f64_e32 v[9:10], v[5:6]2617; VI-SDAG-NEXT: v_rcp_f64_e32 v[11:12], v[7:8]2618; VI-SDAG-NEXT: v_fma_f64 v[13:14], -v[5:6], v[9:10], 1.02619; VI-SDAG-NEXT: v_fma_f64 v[15:16], -v[7:8], v[11:12], 1.02620; VI-SDAG-NEXT: v_fma_f64 v[9:10], v[9:10], v[13:14], v[9:10]2621; VI-SDAG-NEXT: v_div_scale_f64 v[13:14], vcc, -1.0, v[0:1], -1.02622; VI-SDAG-NEXT: v_fma_f64 v[11:12], v[11:12], v[15:16], v[11:12]2623; VI-SDAG-NEXT: v_fma_f64 v[15:16], -v[5:6], v[9:10], 1.02624; VI-SDAG-NEXT: v_fma_f64 v[19:20], -v[7:8], v[11:12], 1.02625; VI-SDAG-NEXT: v_fma_f64 v[9:10], v[9:10], v[15:16], v[9:10]2626; VI-SDAG-NEXT: v_fma_f64 v[11:12], v[11:12], v[19:20], v[11:12]2627; VI-SDAG-NEXT: v_mul_f64 v[15:16], v[13:14], v[9:10]2628; VI-SDAG-NEXT: v_mul_f64 v[19:20], v[17:18], v[11:12]2629; VI-SDAG-NEXT: v_fma_f64 v[4:5], -v[5:6], v[15:16], v[13:14]2630; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[7:8], v[19:20], v[17:18]2631; VI-SDAG-NEXT: v_div_fmas_f64 v[4:5], v[4:5], v[9:10], v[15:16]2632; VI-SDAG-NEXT: s_mov_b64 vcc, s[4:5]2633; VI-SDAG-NEXT: v_div_fmas_f64 v[6:7], v[6:7], v[11:12], v[19:20]2634; VI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[4:5], v[0:1], -1.02635; VI-SDAG-NEXT: v_div_fixup_f64 v[2:3], v[6:7], v[2:3], 1.02636; VI-SDAG-NEXT: s_setpc_b64 s[30:31]2637;2638; VI-GISEL-LABEL: v_neg_pos_rsq_v2f64:2639; VI-GISEL: ; %bb.0:2640; VI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)2641; VI-GISEL-NEXT: v_mov_b32_e32 v4, 02642; VI-GISEL-NEXT: v_bfrev_b32_e32 v5, 82643; VI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[4:5]2644; VI-GISEL-NEXT: v_cmp_lt_f64_e64 s[4:5], v[2:3], v[4:5]2645; VI-GISEL-NEXT: v_cndmask_b32_e64 v6, 0, 1, vcc2646; VI-GISEL-NEXT: v_lshlrev_b32_e32 v6, 8, v62647; VI-GISEL-NEXT: v_cndmask_b32_e64 v4, 0, 1, s[4:5]2648; VI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v62649; VI-GISEL-NEXT: v_lshlrev_b32_e32 v4, 8, v42650; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v42651; VI-GISEL-NEXT: v_rsq_f64_e32 v[4:5], v[0:1]2652; VI-GISEL-NEXT: v_rsq_f64_e32 v[6:7], v[2:3]2653; VI-GISEL-NEXT: v_mul_f64 v[8:9], v[4:5], 0.52654; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[0:1], v[4:5]2655; VI-GISEL-NEXT: v_mul_f64 v[10:11], v[6:7], 0.52656; VI-GISEL-NEXT: v_mul_f64 v[6:7], v[2:3], v[6:7]2657; VI-GISEL-NEXT: v_fma_f64 v[12:13], -v[8:9], v[4:5], 0.52658; VI-GISEL-NEXT: v_fma_f64 v[14:15], -v[10:11], v[6:7], 0.52659; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[12:13], v[4:5]2660; VI-GISEL-NEXT: v_fma_f64 v[8:9], v[8:9], v[12:13], v[8:9]2661; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[14:15], v[6:7]2662; VI-GISEL-NEXT: v_fma_f64 v[10:11], v[10:11], v[14:15], v[10:11]2663; VI-GISEL-NEXT: v_fma_f64 v[12:13], -v[4:5], v[4:5], v[0:1]2664; VI-GISEL-NEXT: v_fma_f64 v[14:15], -v[6:7], v[6:7], v[2:3]2665; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[12:13], v[8:9], v[4:5]2666; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[14:15], v[10:11], v[6:7]2667; VI-GISEL-NEXT: v_fma_f64 v[12:13], -v[4:5], v[4:5], v[0:1]2668; VI-GISEL-NEXT: v_fma_f64 v[14:15], -v[6:7], v[6:7], v[2:3]2669; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[12:13], v[8:9], v[4:5]2670; VI-GISEL-NEXT: v_mov_b32_e32 v8, 0xffffff802671; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[14:15], v[10:11], v[6:7]2672; VI-GISEL-NEXT: v_mov_b32_e32 v9, 0x2602673; VI-GISEL-NEXT: v_cndmask_b32_e32 v10, 0, v8, vcc2674; VI-GISEL-NEXT: v_cndmask_b32_e64 v8, 0, v8, s[4:5]2675; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v92676; VI-GISEL-NEXT: v_cmp_class_f64_e64 s[4:5], v[2:3], v92677; VI-GISEL-NEXT: v_ldexp_f64 v[4:5], v[4:5], v102678; VI-GISEL-NEXT: v_ldexp_f64 v[6:7], v[6:7], v82679; VI-GISEL-NEXT: v_cndmask_b32_e32 v0, v4, v0, vcc2680; VI-GISEL-NEXT: v_cndmask_b32_e32 v1, v5, v1, vcc2681; VI-GISEL-NEXT: v_cndmask_b32_e64 v2, v6, v2, s[4:5]2682; VI-GISEL-NEXT: v_div_scale_f64 v[4:5], s[6:7], v[0:1], v[0:1], -1.02683; VI-GISEL-NEXT: v_cndmask_b32_e64 v3, v7, v3, s[4:5]2684; VI-GISEL-NEXT: v_div_scale_f64 v[6:7], s[4:5], v[2:3], v[2:3], 1.02685; VI-GISEL-NEXT: v_div_scale_f64 v[16:17], s[4:5], 1.0, v[2:3], 1.02686; VI-GISEL-NEXT: v_rcp_f64_e32 v[8:9], v[4:5]2687; VI-GISEL-NEXT: v_rcp_f64_e32 v[10:11], v[6:7]2688; VI-GISEL-NEXT: v_fma_f64 v[12:13], -v[4:5], v[8:9], 1.02689; VI-GISEL-NEXT: v_fma_f64 v[14:15], -v[6:7], v[10:11], 1.02690; VI-GISEL-NEXT: v_fma_f64 v[8:9], v[8:9], v[12:13], v[8:9]2691; VI-GISEL-NEXT: v_div_scale_f64 v[12:13], vcc, -1.0, v[0:1], -1.02692; VI-GISEL-NEXT: v_fma_f64 v[10:11], v[10:11], v[14:15], v[10:11]2693; VI-GISEL-NEXT: v_fma_f64 v[14:15], -v[4:5], v[8:9], 1.02694; VI-GISEL-NEXT: v_fma_f64 v[18:19], -v[6:7], v[10:11], 1.02695; VI-GISEL-NEXT: v_fma_f64 v[8:9], v[8:9], v[14:15], v[8:9]2696; VI-GISEL-NEXT: v_fma_f64 v[10:11], v[10:11], v[18:19], v[10:11]2697; VI-GISEL-NEXT: v_mul_f64 v[14:15], v[12:13], v[8:9]2698; VI-GISEL-NEXT: v_mul_f64 v[18:19], v[16:17], v[10:11]2699; VI-GISEL-NEXT: v_fma_f64 v[4:5], -v[4:5], v[14:15], v[12:13]2700; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[6:7], v[18:19], v[16:17]2701; VI-GISEL-NEXT: v_div_fmas_f64 v[4:5], v[4:5], v[8:9], v[14:15]2702; VI-GISEL-NEXT: s_mov_b64 vcc, s[4:5]2703; VI-GISEL-NEXT: v_div_fmas_f64 v[6:7], v[6:7], v[10:11], v[18:19]2704; VI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[4:5], v[0:1], -1.02705; VI-GISEL-NEXT: v_div_fixup_f64 v[2:3], v[6:7], v[2:3], 1.02706; VI-GISEL-NEXT: s_setpc_b64 s[30:31]2707 %sqrt = call <2 x double> @llvm.sqrt.v2f64(<2 x double> %x)2708 %rsq = fdiv <2 x double> <double -1.0, double 1.0>, %sqrt2709 ret <2 x double> %rsq2710}2711 2712define double @v_rsq_f64_fneg_fabs(double %x) {2713; SI-SDAG-LABEL: v_rsq_f64_fneg_fabs:2714; SI-SDAG: ; %bb.0:2715; SI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)2716; SI-SDAG-NEXT: s_mov_b32 s4, 02717; SI-SDAG-NEXT: s_brev_b32 s5, 92718; SI-SDAG-NEXT: v_cmp_gt_f64_e64 vcc, |v[0:1]|, s[4:5]2719; SI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1002720; SI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc2721; SI-SDAG-NEXT: v_ldexp_f64 v[0:1], -|v[0:1]|, v22722; SI-SDAG-NEXT: v_mov_b32_e32 v8, 0xffffff802723; SI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]2724; SI-SDAG-NEXT: v_mov_b32_e32 v9, 0x2602725; SI-SDAG-NEXT: s_mov_b32 s6, 0x3ff000002726; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]2727; SI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.52728; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.52729; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]2730; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]2731; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]2732; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]2733; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]2734; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]2735; SI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc2736; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v42737; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v92738; SI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc2739; SI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc2740; SI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.02741; SI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]2742; SI-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, v1, v32743; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.02744; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]2745; SI-SDAG-NEXT: v_div_scale_f64 v[6:7], s[4:5], 1.0, v[0:1], 1.02746; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.02747; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]2748; SI-SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], s6, v72749; SI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]2750; SI-SDAG-NEXT: s_xor_b64 vcc, s[4:5], vcc2751; SI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]2752; SI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]2753; SI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.02754; SI-SDAG-NEXT: s_setpc_b64 s[30:31]2755;2756; SI-GISEL-LABEL: v_rsq_f64_fneg_fabs:2757; SI-GISEL: ; %bb.0:2758; SI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)2759; SI-GISEL-NEXT: v_mov_b32_e32 v2, 02760; SI-GISEL-NEXT: v_bfrev_b32_e32 v3, 82761; SI-GISEL-NEXT: v_cmp_lt_f64_e64 vcc, -|v[0:1]|, v[2:3]2762; SI-GISEL-NEXT: v_mov_b32_e32 v8, 0xffffff802763; SI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc2764; SI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v22765; SI-GISEL-NEXT: v_ldexp_f64 v[0:1], -|v[0:1]|, v22766; SI-GISEL-NEXT: v_mov_b32_e32 v9, 0x2602767; SI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]2768; SI-GISEL-NEXT: v_mov_b32_e32 v10, 0x3ff000002769; SI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.52770; SI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]2771; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.52772; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]2773; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]2774; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]2775; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]2776; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]2777; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]2778; SI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc2779; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v42780; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v92781; SI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc2782; SI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc2783; SI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.02784; SI-GISEL-NEXT: v_div_scale_f64 v[8:9], s[4:5], 1.0, v[0:1], 1.02785; SI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]2786; SI-GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], v1, v32787; SI-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v9, v102788; SI-GISEL-NEXT: s_xor_b64 vcc, vcc, s[4:5]2789; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.02790; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]2791; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.02792; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]2793; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[8:9], v[4:5]2794; SI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[6:7], v[8:9]2795; SI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[6:7]2796; SI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.02797; SI-GISEL-NEXT: s_setpc_b64 s[30:31]2798;2799; VI-SDAG-LABEL: v_rsq_f64_fneg_fabs:2800; VI-SDAG: ; %bb.0:2801; VI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)2802; VI-SDAG-NEXT: s_mov_b32 s4, 02803; VI-SDAG-NEXT: s_brev_b32 s5, 92804; VI-SDAG-NEXT: v_cmp_gt_f64_e64 vcc, |v[0:1]|, s[4:5]2805; VI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1002806; VI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc2807; VI-SDAG-NEXT: v_ldexp_f64 v[0:1], -|v[0:1]|, v22808; VI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]2809; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]2810; VI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.52811; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.52812; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]2813; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]2814; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]2815; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]2816; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]2817; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]2818; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0xffffff802819; VI-SDAG-NEXT: v_mov_b32_e32 v5, 0x2602820; VI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc2821; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v52822; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v42823; VI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc2824; VI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc2825; VI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.02826; VI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]2827; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.02828; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]2829; VI-SDAG-NEXT: v_div_scale_f64 v[6:7], vcc, 1.0, v[0:1], 1.02830; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.02831; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]2832; VI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]2833; VI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]2834; VI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]2835; VI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.02836; VI-SDAG-NEXT: s_setpc_b64 s[30:31]2837;2838; VI-GISEL-LABEL: v_rsq_f64_fneg_fabs:2839; VI-GISEL: ; %bb.0:2840; VI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)2841; VI-GISEL-NEXT: v_mov_b32_e32 v2, 02842; VI-GISEL-NEXT: v_bfrev_b32_e32 v3, 82843; VI-GISEL-NEXT: v_cmp_lt_f64_e64 vcc, -|v[0:1]|, v[2:3]2844; VI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc2845; VI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v22846; VI-GISEL-NEXT: v_ldexp_f64 v[0:1], -|v[0:1]|, v22847; VI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]2848; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.52849; VI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]2850; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.52851; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]2852; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]2853; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]2854; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]2855; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]2856; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]2857; VI-GISEL-NEXT: v_mov_b32_e32 v4, 0xffffff802858; VI-GISEL-NEXT: v_mov_b32_e32 v5, 0x2602859; VI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc2860; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v52861; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v42862; VI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc2863; VI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc2864; VI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.02865; VI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]2866; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.02867; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]2868; VI-GISEL-NEXT: v_div_scale_f64 v[6:7], vcc, 1.0, v[0:1], 1.02869; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.02870; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]2871; VI-GISEL-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]2872; VI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]2873; VI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]2874; VI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.02875; VI-GISEL-NEXT: s_setpc_b64 s[30:31]2876 %fabs = call double @llvm.fabs.f64(double %x)2877 %fneg.fabs = fneg double %fabs2878 %sqrt = call contract double @llvm.sqrt.f64(double %fneg.fabs)2879 %rsq = fdiv contract double 1.0, %sqrt2880 ret double %rsq2881}2882 2883define double @v_rsq_f64__afn_sqrt(double %x) {2884; SI-SDAG-LABEL: v_rsq_f64__afn_sqrt:2885; SI-SDAG: ; %bb.0:2886; SI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)2887; SI-SDAG-NEXT: s_mov_b32 s4, 02888; SI-SDAG-NEXT: s_brev_b32 s5, 82889; SI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]2890; SI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1002891; SI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc2892; SI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v22893; SI-SDAG-NEXT: v_mov_b32_e32 v8, 0xffffff802894; SI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]2895; SI-SDAG-NEXT: v_mov_b32_e32 v9, 0x2602896; SI-SDAG-NEXT: s_mov_b32 s6, 0x3ff000002897; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]2898; SI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.52899; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.52900; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]2901; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]2902; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]2903; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]2904; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]2905; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]2906; SI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc2907; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v42908; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v92909; SI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc2910; SI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc2911; SI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.02912; SI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]2913; SI-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, v1, v32914; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.02915; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]2916; SI-SDAG-NEXT: v_div_scale_f64 v[6:7], s[4:5], 1.0, v[0:1], 1.02917; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.02918; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]2919; SI-SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], s6, v72920; SI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]2921; SI-SDAG-NEXT: s_xor_b64 vcc, s[4:5], vcc2922; SI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]2923; SI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]2924; SI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.02925; SI-SDAG-NEXT: s_setpc_b64 s[30:31]2926;2927; SI-GISEL-LABEL: v_rsq_f64__afn_sqrt:2928; SI-GISEL: ; %bb.0:2929; SI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)2930; SI-GISEL-NEXT: v_mov_b32_e32 v2, 02931; SI-GISEL-NEXT: v_bfrev_b32_e32 v3, 82932; SI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]2933; SI-GISEL-NEXT: v_mov_b32_e32 v8, 0xffffff802934; SI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc2935; SI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v22936; SI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v22937; SI-GISEL-NEXT: v_mov_b32_e32 v9, 0x2602938; SI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]2939; SI-GISEL-NEXT: v_mov_b32_e32 v10, 0x3ff000002940; SI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.52941; SI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]2942; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.52943; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]2944; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]2945; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]2946; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]2947; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]2948; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]2949; SI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc2950; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v42951; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v92952; SI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc2953; SI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc2954; SI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.02955; SI-GISEL-NEXT: v_div_scale_f64 v[8:9], s[4:5], 1.0, v[0:1], 1.02956; SI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]2957; SI-GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], v1, v32958; SI-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v9, v102959; SI-GISEL-NEXT: s_xor_b64 vcc, vcc, s[4:5]2960; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.02961; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]2962; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.02963; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]2964; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[8:9], v[4:5]2965; SI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[6:7], v[8:9]2966; SI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[6:7]2967; SI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.02968; SI-GISEL-NEXT: s_setpc_b64 s[30:31]2969;2970; VI-SDAG-LABEL: v_rsq_f64__afn_sqrt:2971; VI-SDAG: ; %bb.0:2972; VI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)2973; VI-SDAG-NEXT: s_mov_b32 s4, 02974; VI-SDAG-NEXT: s_brev_b32 s5, 82975; VI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]2976; VI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1002977; VI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc2978; VI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v22979; VI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]2980; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]2981; VI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.52982; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.52983; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]2984; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]2985; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]2986; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]2987; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]2988; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]2989; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0xffffff802990; VI-SDAG-NEXT: v_mov_b32_e32 v5, 0x2602991; VI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc2992; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v52993; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v42994; VI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc2995; VI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc2996; VI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.02997; VI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]2998; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.02999; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3000; VI-SDAG-NEXT: v_div_scale_f64 v[6:7], vcc, 1.0, v[0:1], 1.03001; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.03002; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]3003; VI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]3004; VI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]3005; VI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]3006; VI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.03007; VI-SDAG-NEXT: s_setpc_b64 s[30:31]3008;3009; VI-GISEL-LABEL: v_rsq_f64__afn_sqrt:3010; VI-GISEL: ; %bb.0:3011; VI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3012; VI-GISEL-NEXT: v_mov_b32_e32 v2, 03013; VI-GISEL-NEXT: v_bfrev_b32_e32 v3, 83014; VI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]3015; VI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc3016; VI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v23017; VI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v23018; VI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]3019; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.53020; VI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]3021; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.53022; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]3023; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3024; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3025; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3026; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3027; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3028; VI-GISEL-NEXT: v_mov_b32_e32 v4, 0xffffff803029; VI-GISEL-NEXT: v_mov_b32_e32 v5, 0x2603030; VI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc3031; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v53032; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v43033; VI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc3034; VI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc3035; VI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.03036; VI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]3037; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.03038; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3039; VI-GISEL-NEXT: v_div_scale_f64 v[6:7], vcc, 1.0, v[0:1], 1.03040; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.03041; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]3042; VI-GISEL-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]3043; VI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]3044; VI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]3045; VI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.03046; VI-GISEL-NEXT: s_setpc_b64 s[30:31]3047 %sqrt = call contract afn double @llvm.sqrt.f64(double %x)3048 %rsq = fdiv contract double 1.0, %sqrt3049 ret double %rsq3050}3051 3052define double @v_rsq_f64__afn_fdiv(double %x) {3053; SI-SDAG-LABEL: v_rsq_f64__afn_fdiv:3054; SI-SDAG: ; %bb.0:3055; SI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3056; SI-SDAG-NEXT: s_mov_b32 s4, 03057; SI-SDAG-NEXT: s_brev_b32 s5, 83058; SI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]3059; SI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1003060; SI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc3061; SI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v23062; SI-SDAG-NEXT: v_mov_b32_e32 v8, 0xffffff803063; SI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]3064; SI-SDAG-NEXT: v_mov_b32_e32 v9, 0x2603065; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]3066; SI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.53067; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.53068; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3069; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]3070; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]3071; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]3072; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]3073; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]3074; SI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc3075; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v43076; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v93077; SI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc3078; SI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc3079; SI-SDAG-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]3080; SI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03081; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3082; SI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03083; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3084; SI-SDAG-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.03085; SI-SDAG-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]3086; SI-SDAG-NEXT: s_setpc_b64 s[30:31]3087;3088; SI-GISEL-LABEL: v_rsq_f64__afn_fdiv:3089; SI-GISEL: ; %bb.0:3090; SI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3091; SI-GISEL-NEXT: v_mov_b32_e32 v2, 03092; SI-GISEL-NEXT: v_bfrev_b32_e32 v3, 83093; SI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]3094; SI-GISEL-NEXT: v_mov_b32_e32 v8, 0xffffff803095; SI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc3096; SI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v23097; SI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v23098; SI-GISEL-NEXT: v_mov_b32_e32 v9, 0x2603099; SI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]3100; SI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.53101; SI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]3102; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.53103; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]3104; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3105; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3106; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3107; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3108; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3109; SI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc3110; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v43111; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v93112; SI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc3113; SI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc3114; SI-GISEL-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]3115; SI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03116; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3117; SI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03118; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3119; SI-GISEL-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.03120; SI-GISEL-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]3121; SI-GISEL-NEXT: s_setpc_b64 s[30:31]3122;3123; VI-SDAG-LABEL: v_rsq_f64__afn_fdiv:3124; VI-SDAG: ; %bb.0:3125; VI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3126; VI-SDAG-NEXT: s_mov_b32 s4, 03127; VI-SDAG-NEXT: s_brev_b32 s5, 83128; VI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]3129; VI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1003130; VI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc3131; VI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v23132; VI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]3133; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]3134; VI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.53135; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.53136; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3137; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]3138; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]3139; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]3140; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]3141; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]3142; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0xffffff803143; VI-SDAG-NEXT: v_mov_b32_e32 v5, 0x2603144; VI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc3145; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v53146; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v43147; VI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc3148; VI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc3149; VI-SDAG-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]3150; VI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03151; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3152; VI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03153; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3154; VI-SDAG-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.03155; VI-SDAG-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]3156; VI-SDAG-NEXT: s_setpc_b64 s[30:31]3157;3158; VI-GISEL-LABEL: v_rsq_f64__afn_fdiv:3159; VI-GISEL: ; %bb.0:3160; VI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3161; VI-GISEL-NEXT: v_mov_b32_e32 v2, 03162; VI-GISEL-NEXT: v_bfrev_b32_e32 v3, 83163; VI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]3164; VI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc3165; VI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v23166; VI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v23167; VI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]3168; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.53169; VI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]3170; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.53171; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]3172; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3173; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3174; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3175; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3176; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3177; VI-GISEL-NEXT: v_mov_b32_e32 v4, 0xffffff803178; VI-GISEL-NEXT: v_mov_b32_e32 v5, 0x2603179; VI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc3180; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v53181; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v43182; VI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc3183; VI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc3184; VI-GISEL-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]3185; VI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03186; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3187; VI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03188; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3189; VI-GISEL-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.03190; VI-GISEL-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]3191; VI-GISEL-NEXT: s_setpc_b64 s[30:31]3192 %sqrt = call contract double @llvm.sqrt.f64(double %x)3193 %rsq = fdiv contract afn double 1.0, %sqrt3194 ret double %rsq3195}3196 3197define double @v_rsq_f64__afn(double %x) {3198; SI-SDAG-LABEL: v_rsq_f64__afn:3199; SI-SDAG: ; %bb.0:3200; SI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3201; SI-SDAG-NEXT: s_mov_b32 s4, 03202; SI-SDAG-NEXT: s_brev_b32 s5, 83203; SI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]3204; SI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1003205; SI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc3206; SI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v23207; SI-SDAG-NEXT: v_mov_b32_e32 v8, 0xffffff803208; SI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]3209; SI-SDAG-NEXT: v_mov_b32_e32 v9, 0x2603210; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]3211; SI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.53212; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.53213; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3214; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]3215; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]3216; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]3217; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]3218; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]3219; SI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc3220; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v43221; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v93222; SI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc3223; SI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc3224; SI-SDAG-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]3225; SI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03226; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3227; SI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03228; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3229; SI-SDAG-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.03230; SI-SDAG-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]3231; SI-SDAG-NEXT: s_setpc_b64 s[30:31]3232;3233; SI-GISEL-LABEL: v_rsq_f64__afn:3234; SI-GISEL: ; %bb.0:3235; SI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3236; SI-GISEL-NEXT: v_mov_b32_e32 v2, 03237; SI-GISEL-NEXT: v_bfrev_b32_e32 v3, 83238; SI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]3239; SI-GISEL-NEXT: v_mov_b32_e32 v8, 0xffffff803240; SI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc3241; SI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v23242; SI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v23243; SI-GISEL-NEXT: v_mov_b32_e32 v9, 0x2603244; SI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]3245; SI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.53246; SI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]3247; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.53248; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]3249; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3250; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3251; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3252; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3253; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3254; SI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc3255; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v43256; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v93257; SI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc3258; SI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc3259; SI-GISEL-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]3260; SI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03261; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3262; SI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03263; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3264; SI-GISEL-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.03265; SI-GISEL-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]3266; SI-GISEL-NEXT: s_setpc_b64 s[30:31]3267;3268; VI-SDAG-LABEL: v_rsq_f64__afn:3269; VI-SDAG: ; %bb.0:3270; VI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3271; VI-SDAG-NEXT: s_mov_b32 s4, 03272; VI-SDAG-NEXT: s_brev_b32 s5, 83273; VI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]3274; VI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1003275; VI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc3276; VI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v23277; VI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]3278; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]3279; VI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.53280; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.53281; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3282; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]3283; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]3284; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]3285; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]3286; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]3287; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0xffffff803288; VI-SDAG-NEXT: v_mov_b32_e32 v5, 0x2603289; VI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc3290; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v53291; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v43292; VI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc3293; VI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc3294; VI-SDAG-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]3295; VI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03296; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3297; VI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03298; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3299; VI-SDAG-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.03300; VI-SDAG-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]3301; VI-SDAG-NEXT: s_setpc_b64 s[30:31]3302;3303; VI-GISEL-LABEL: v_rsq_f64__afn:3304; VI-GISEL: ; %bb.0:3305; VI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3306; VI-GISEL-NEXT: v_mov_b32_e32 v2, 03307; VI-GISEL-NEXT: v_bfrev_b32_e32 v3, 83308; VI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]3309; VI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc3310; VI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v23311; VI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v23312; VI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]3313; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.53314; VI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]3315; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.53316; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]3317; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3318; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3319; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3320; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3321; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3322; VI-GISEL-NEXT: v_mov_b32_e32 v4, 0xffffff803323; VI-GISEL-NEXT: v_mov_b32_e32 v5, 0x2603324; VI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc3325; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v53326; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v43327; VI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc3328; VI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc3329; VI-GISEL-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]3330; VI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03331; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3332; VI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03333; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3334; VI-GISEL-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.03335; VI-GISEL-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]3336; VI-GISEL-NEXT: s_setpc_b64 s[30:31]3337 %sqrt = call contract afn double @llvm.sqrt.f64(double %x)3338 %rsq = fdiv contract afn double 1.0, %sqrt3339 ret double %rsq3340}3341 3342define double @v_neg_rsq_f64__afn(double %x) {3343; SI-SDAG-LABEL: v_neg_rsq_f64__afn:3344; SI-SDAG: ; %bb.0:3345; SI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3346; SI-SDAG-NEXT: s_mov_b32 s4, 03347; SI-SDAG-NEXT: s_brev_b32 s5, 83348; SI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]3349; SI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1003350; SI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc3351; SI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v23352; SI-SDAG-NEXT: v_mov_b32_e32 v8, 0xffffff803353; SI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]3354; SI-SDAG-NEXT: v_mov_b32_e32 v9, 0x2603355; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]3356; SI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.53357; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.53358; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3359; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]3360; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]3361; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]3362; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]3363; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]3364; SI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc3365; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v43366; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v93367; SI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc3368; SI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc3369; SI-SDAG-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]3370; SI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03371; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3372; SI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03373; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3374; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[2:3], -1.03375; SI-SDAG-NEXT: v_fma_f64 v[0:1], -v[0:1], v[4:5], -1.03376; SI-SDAG-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[4:5]3377; SI-SDAG-NEXT: s_setpc_b64 s[30:31]3378;3379; SI-GISEL-LABEL: v_neg_rsq_f64__afn:3380; SI-GISEL: ; %bb.0:3381; SI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3382; SI-GISEL-NEXT: v_mov_b32_e32 v2, 03383; SI-GISEL-NEXT: v_bfrev_b32_e32 v3, 83384; SI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]3385; SI-GISEL-NEXT: v_mov_b32_e32 v8, 0xffffff803386; SI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc3387; SI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v23388; SI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v23389; SI-GISEL-NEXT: v_mov_b32_e32 v9, 0x2603390; SI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]3391; SI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.53392; SI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]3393; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.53394; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]3395; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3396; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3397; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3398; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3399; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3400; SI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc3401; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v43402; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v93403; SI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc3404; SI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc3405; SI-GISEL-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]3406; SI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03407; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3408; SI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03409; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3410; SI-GISEL-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], -1.03411; SI-GISEL-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], -v[2:3]3412; SI-GISEL-NEXT: s_setpc_b64 s[30:31]3413;3414; VI-SDAG-LABEL: v_neg_rsq_f64__afn:3415; VI-SDAG: ; %bb.0:3416; VI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3417; VI-SDAG-NEXT: s_mov_b32 s4, 03418; VI-SDAG-NEXT: s_brev_b32 s5, 83419; VI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]3420; VI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1003421; VI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc3422; VI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v23423; VI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]3424; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]3425; VI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.53426; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.53427; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3428; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]3429; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]3430; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]3431; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]3432; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]3433; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0xffffff803434; VI-SDAG-NEXT: v_mov_b32_e32 v5, 0x2603435; VI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc3436; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v53437; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v43438; VI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc3439; VI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc3440; VI-SDAG-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]3441; VI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03442; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3443; VI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03444; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3445; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[2:3], -1.03446; VI-SDAG-NEXT: v_fma_f64 v[0:1], -v[0:1], v[4:5], -1.03447; VI-SDAG-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[4:5]3448; VI-SDAG-NEXT: s_setpc_b64 s[30:31]3449;3450; VI-GISEL-LABEL: v_neg_rsq_f64__afn:3451; VI-GISEL: ; %bb.0:3452; VI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3453; VI-GISEL-NEXT: v_mov_b32_e32 v2, 03454; VI-GISEL-NEXT: v_bfrev_b32_e32 v3, 83455; VI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]3456; VI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc3457; VI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v23458; VI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v23459; VI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]3460; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.53461; VI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]3462; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.53463; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]3464; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3465; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3466; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3467; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3468; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3469; VI-GISEL-NEXT: v_mov_b32_e32 v4, 0xffffff803470; VI-GISEL-NEXT: v_mov_b32_e32 v5, 0x2603471; VI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc3472; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v53473; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v43474; VI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc3475; VI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc3476; VI-GISEL-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]3477; VI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03478; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3479; VI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03480; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3481; VI-GISEL-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], -1.03482; VI-GISEL-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], -v[2:3]3483; VI-GISEL-NEXT: s_setpc_b64 s[30:31]3484 %sqrt = call contract afn double @llvm.sqrt.f64(double %x)3485 %rsq = fdiv contract afn double -1.0, %sqrt3486 ret double %rsq3487}3488 3489define double @v_rsq_f64__afn_ninf(double %x) {3490; SI-SDAG-LABEL: v_rsq_f64__afn_ninf:3491; SI-SDAG: ; %bb.0:3492; SI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3493; SI-SDAG-NEXT: s_mov_b32 s4, 03494; SI-SDAG-NEXT: s_brev_b32 s5, 83495; SI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]3496; SI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1003497; SI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc3498; SI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v23499; SI-SDAG-NEXT: v_mov_b32_e32 v8, 0xffffff803500; SI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]3501; SI-SDAG-NEXT: v_mov_b32_e32 v9, 0x2603502; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]3503; SI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.53504; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.53505; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3506; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]3507; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]3508; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]3509; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]3510; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]3511; SI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc3512; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v43513; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v93514; SI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc3515; SI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc3516; SI-SDAG-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]3517; SI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03518; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3519; SI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03520; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3521; SI-SDAG-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.03522; SI-SDAG-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]3523; SI-SDAG-NEXT: s_setpc_b64 s[30:31]3524;3525; SI-GISEL-LABEL: v_rsq_f64__afn_ninf:3526; SI-GISEL: ; %bb.0:3527; SI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3528; SI-GISEL-NEXT: v_mov_b32_e32 v2, 03529; SI-GISEL-NEXT: v_bfrev_b32_e32 v3, 83530; SI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]3531; SI-GISEL-NEXT: v_mov_b32_e32 v8, 0xffffff803532; SI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc3533; SI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v23534; SI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v23535; SI-GISEL-NEXT: v_mov_b32_e32 v9, 0x2603536; SI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]3537; SI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.53538; SI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]3539; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.53540; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]3541; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3542; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3543; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3544; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3545; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3546; SI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc3547; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v43548; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v93549; SI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc3550; SI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc3551; SI-GISEL-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]3552; SI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03553; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3554; SI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03555; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3556; SI-GISEL-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.03557; SI-GISEL-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]3558; SI-GISEL-NEXT: s_setpc_b64 s[30:31]3559;3560; VI-SDAG-LABEL: v_rsq_f64__afn_ninf:3561; VI-SDAG: ; %bb.0:3562; VI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3563; VI-SDAG-NEXT: s_mov_b32 s4, 03564; VI-SDAG-NEXT: s_brev_b32 s5, 83565; VI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]3566; VI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1003567; VI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc3568; VI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v23569; VI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]3570; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]3571; VI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.53572; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.53573; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3574; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]3575; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]3576; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]3577; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]3578; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]3579; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0xffffff803580; VI-SDAG-NEXT: v_mov_b32_e32 v5, 0x2603581; VI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc3582; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v53583; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v43584; VI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc3585; VI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc3586; VI-SDAG-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]3587; VI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03588; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3589; VI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03590; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3591; VI-SDAG-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.03592; VI-SDAG-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]3593; VI-SDAG-NEXT: s_setpc_b64 s[30:31]3594;3595; VI-GISEL-LABEL: v_rsq_f64__afn_ninf:3596; VI-GISEL: ; %bb.0:3597; VI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3598; VI-GISEL-NEXT: v_mov_b32_e32 v2, 03599; VI-GISEL-NEXT: v_bfrev_b32_e32 v3, 83600; VI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]3601; VI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc3602; VI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v23603; VI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v23604; VI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]3605; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.53606; VI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]3607; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.53608; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]3609; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3610; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3611; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3612; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3613; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3614; VI-GISEL-NEXT: v_mov_b32_e32 v4, 0xffffff803615; VI-GISEL-NEXT: v_mov_b32_e32 v5, 0x2603616; VI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc3617; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v53618; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v43619; VI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc3620; VI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc3621; VI-GISEL-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]3622; VI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03623; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3624; VI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03625; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3626; VI-GISEL-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.03627; VI-GISEL-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]3628; VI-GISEL-NEXT: s_setpc_b64 s[30:31]3629 %sqrt = call contract afn ninf double @llvm.sqrt.f64(double %x)3630 %rsq = fdiv contract afn ninf double 1.0, %sqrt3631 ret double %rsq3632}3633 3634define double @v_rsq_f64__afn_nnan(double %x) {3635; SI-SDAG-LABEL: v_rsq_f64__afn_nnan:3636; SI-SDAG: ; %bb.0:3637; SI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3638; SI-SDAG-NEXT: s_mov_b32 s4, 03639; SI-SDAG-NEXT: s_brev_b32 s5, 83640; SI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]3641; SI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1003642; SI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc3643; SI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v23644; SI-SDAG-NEXT: v_mov_b32_e32 v8, 0xffffff803645; SI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]3646; SI-SDAG-NEXT: v_mov_b32_e32 v9, 0x2603647; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]3648; SI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.53649; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.53650; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3651; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]3652; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]3653; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]3654; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]3655; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]3656; SI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc3657; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v43658; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v93659; SI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc3660; SI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc3661; SI-SDAG-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]3662; SI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03663; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3664; SI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03665; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3666; SI-SDAG-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.03667; SI-SDAG-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]3668; SI-SDAG-NEXT: s_setpc_b64 s[30:31]3669;3670; SI-GISEL-LABEL: v_rsq_f64__afn_nnan:3671; SI-GISEL: ; %bb.0:3672; SI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3673; SI-GISEL-NEXT: v_mov_b32_e32 v2, 03674; SI-GISEL-NEXT: v_bfrev_b32_e32 v3, 83675; SI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]3676; SI-GISEL-NEXT: v_mov_b32_e32 v8, 0xffffff803677; SI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc3678; SI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v23679; SI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v23680; SI-GISEL-NEXT: v_mov_b32_e32 v9, 0x2603681; SI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]3682; SI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.53683; SI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]3684; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.53685; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]3686; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3687; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3688; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3689; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3690; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3691; SI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc3692; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v43693; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v93694; SI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc3695; SI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc3696; SI-GISEL-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]3697; SI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03698; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3699; SI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03700; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3701; SI-GISEL-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.03702; SI-GISEL-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]3703; SI-GISEL-NEXT: s_setpc_b64 s[30:31]3704;3705; VI-SDAG-LABEL: v_rsq_f64__afn_nnan:3706; VI-SDAG: ; %bb.0:3707; VI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3708; VI-SDAG-NEXT: s_mov_b32 s4, 03709; VI-SDAG-NEXT: s_brev_b32 s5, 83710; VI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]3711; VI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1003712; VI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc3713; VI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v23714; VI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]3715; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]3716; VI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.53717; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.53718; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3719; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]3720; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]3721; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]3722; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]3723; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]3724; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0xffffff803725; VI-SDAG-NEXT: v_mov_b32_e32 v5, 0x2603726; VI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc3727; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v53728; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v43729; VI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc3730; VI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc3731; VI-SDAG-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]3732; VI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03733; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3734; VI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03735; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3736; VI-SDAG-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.03737; VI-SDAG-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]3738; VI-SDAG-NEXT: s_setpc_b64 s[30:31]3739;3740; VI-GISEL-LABEL: v_rsq_f64__afn_nnan:3741; VI-GISEL: ; %bb.0:3742; VI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3743; VI-GISEL-NEXT: v_mov_b32_e32 v2, 03744; VI-GISEL-NEXT: v_bfrev_b32_e32 v3, 83745; VI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]3746; VI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc3747; VI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v23748; VI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v23749; VI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]3750; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.53751; VI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]3752; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.53753; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]3754; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3755; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3756; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3757; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3758; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3759; VI-GISEL-NEXT: v_mov_b32_e32 v4, 0xffffff803760; VI-GISEL-NEXT: v_mov_b32_e32 v5, 0x2603761; VI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc3762; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v53763; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v43764; VI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc3765; VI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc3766; VI-GISEL-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]3767; VI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03768; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3769; VI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03770; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3771; VI-GISEL-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.03772; VI-GISEL-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]3773; VI-GISEL-NEXT: s_setpc_b64 s[30:31]3774 %sqrt = call contract afn nnan double @llvm.sqrt.f64(double %x)3775 %rsq = fdiv contract afn nnan double 1.0, %sqrt3776 ret double %rsq3777}3778 3779define double @v_rsq_f64__afn_nnan_ninf(double %x) {3780; SI-SDAG-LABEL: v_rsq_f64__afn_nnan_ninf:3781; SI-SDAG: ; %bb.0:3782; SI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3783; SI-SDAG-NEXT: s_mov_b32 s4, 03784; SI-SDAG-NEXT: s_brev_b32 s5, 83785; SI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]3786; SI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1003787; SI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc3788; SI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v23789; SI-SDAG-NEXT: v_mov_b32_e32 v8, 0xffffff803790; SI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]3791; SI-SDAG-NEXT: v_mov_b32_e32 v9, 0x2603792; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]3793; SI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.53794; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.53795; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3796; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]3797; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]3798; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]3799; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]3800; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]3801; SI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc3802; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v43803; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v93804; SI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc3805; SI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc3806; SI-SDAG-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]3807; SI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03808; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3809; SI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03810; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3811; SI-SDAG-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.03812; SI-SDAG-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]3813; SI-SDAG-NEXT: s_setpc_b64 s[30:31]3814;3815; SI-GISEL-LABEL: v_rsq_f64__afn_nnan_ninf:3816; SI-GISEL: ; %bb.0:3817; SI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3818; SI-GISEL-NEXT: v_mov_b32_e32 v2, 03819; SI-GISEL-NEXT: v_bfrev_b32_e32 v3, 83820; SI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]3821; SI-GISEL-NEXT: v_mov_b32_e32 v8, 0xffffff803822; SI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc3823; SI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v23824; SI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v23825; SI-GISEL-NEXT: v_mov_b32_e32 v9, 0x2603826; SI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]3827; SI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.53828; SI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]3829; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.53830; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]3831; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3832; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3833; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3834; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3835; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3836; SI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc3837; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v43838; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v93839; SI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc3840; SI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc3841; SI-GISEL-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]3842; SI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03843; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3844; SI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03845; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3846; SI-GISEL-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.03847; SI-GISEL-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]3848; SI-GISEL-NEXT: s_setpc_b64 s[30:31]3849;3850; VI-SDAG-LABEL: v_rsq_f64__afn_nnan_ninf:3851; VI-SDAG: ; %bb.0:3852; VI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3853; VI-SDAG-NEXT: s_mov_b32 s4, 03854; VI-SDAG-NEXT: s_brev_b32 s5, 83855; VI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]3856; VI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1003857; VI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc3858; VI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v23859; VI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]3860; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]3861; VI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.53862; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.53863; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3864; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]3865; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]3866; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]3867; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]3868; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]3869; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0xffffff803870; VI-SDAG-NEXT: v_mov_b32_e32 v5, 0x2603871; VI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc3872; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v53873; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v43874; VI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc3875; VI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc3876; VI-SDAG-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]3877; VI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03878; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3879; VI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03880; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3881; VI-SDAG-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.03882; VI-SDAG-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]3883; VI-SDAG-NEXT: s_setpc_b64 s[30:31]3884;3885; VI-GISEL-LABEL: v_rsq_f64__afn_nnan_ninf:3886; VI-GISEL: ; %bb.0:3887; VI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3888; VI-GISEL-NEXT: v_mov_b32_e32 v2, 03889; VI-GISEL-NEXT: v_bfrev_b32_e32 v3, 83890; VI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]3891; VI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc3892; VI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v23893; VI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v23894; VI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]3895; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.53896; VI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]3897; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.53898; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]3899; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3900; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3901; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3902; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3903; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3904; VI-GISEL-NEXT: v_mov_b32_e32 v4, 0xffffff803905; VI-GISEL-NEXT: v_mov_b32_e32 v5, 0x2603906; VI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc3907; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v53908; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v43909; VI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc3910; VI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc3911; VI-GISEL-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]3912; VI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03913; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3914; VI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03915; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3916; VI-GISEL-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.03917; VI-GISEL-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]3918; VI-GISEL-NEXT: s_setpc_b64 s[30:31]3919 %sqrt = call contract afn nnan ninf double @llvm.sqrt.f64(double %x)3920 %rsq = fdiv contract afn nnan ninf double 1.0, %sqrt3921 ret double %rsq3922}3923 3924define double @v_neg_rsq_f64__afn_nnan_ninf(double %x) {3925; SI-SDAG-LABEL: v_neg_rsq_f64__afn_nnan_ninf:3926; SI-SDAG: ; %bb.0:3927; SI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3928; SI-SDAG-NEXT: s_mov_b32 s4, 03929; SI-SDAG-NEXT: s_brev_b32 s5, 83930; SI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]3931; SI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1003932; SI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc3933; SI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v23934; SI-SDAG-NEXT: v_mov_b32_e32 v8, 0xffffff803935; SI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]3936; SI-SDAG-NEXT: v_mov_b32_e32 v9, 0x2603937; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]3938; SI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.53939; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.53940; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3941; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]3942; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]3943; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]3944; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]3945; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]3946; SI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc3947; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v43948; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v93949; SI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc3950; SI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc3951; SI-SDAG-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]3952; SI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03953; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3954; SI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03955; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3956; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[2:3], -1.03957; SI-SDAG-NEXT: v_fma_f64 v[0:1], -v[0:1], v[4:5], -1.03958; SI-SDAG-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[4:5]3959; SI-SDAG-NEXT: s_setpc_b64 s[30:31]3960;3961; SI-GISEL-LABEL: v_neg_rsq_f64__afn_nnan_ninf:3962; SI-GISEL: ; %bb.0:3963; SI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3964; SI-GISEL-NEXT: v_mov_b32_e32 v2, 03965; SI-GISEL-NEXT: v_bfrev_b32_e32 v3, 83966; SI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]3967; SI-GISEL-NEXT: v_mov_b32_e32 v8, 0xffffff803968; SI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc3969; SI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v23970; SI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v23971; SI-GISEL-NEXT: v_mov_b32_e32 v9, 0x2603972; SI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]3973; SI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.53974; SI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]3975; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.53976; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]3977; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]3978; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3979; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3980; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]3981; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]3982; SI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc3983; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v43984; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v93985; SI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc3986; SI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc3987; SI-GISEL-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]3988; SI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03989; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3990; SI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.03991; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]3992; SI-GISEL-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], -1.03993; SI-GISEL-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], -v[2:3]3994; SI-GISEL-NEXT: s_setpc_b64 s[30:31]3995;3996; VI-SDAG-LABEL: v_neg_rsq_f64__afn_nnan_ninf:3997; VI-SDAG: ; %bb.0:3998; VI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)3999; VI-SDAG-NEXT: s_mov_b32 s4, 04000; VI-SDAG-NEXT: s_brev_b32 s5, 84001; VI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]4002; VI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1004003; VI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc4004; VI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v24005; VI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]4006; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]4007; VI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.54008; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.54009; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4010; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]4011; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]4012; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]4013; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]4014; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]4015; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0xffffff804016; VI-SDAG-NEXT: v_mov_b32_e32 v5, 0x2604017; VI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc4018; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v54019; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v44020; VI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc4021; VI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc4022; VI-SDAG-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]4023; VI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.04024; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]4025; VI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.04026; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]4027; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[2:3], -1.04028; VI-SDAG-NEXT: v_fma_f64 v[0:1], -v[0:1], v[4:5], -1.04029; VI-SDAG-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[4:5]4030; VI-SDAG-NEXT: s_setpc_b64 s[30:31]4031;4032; VI-GISEL-LABEL: v_neg_rsq_f64__afn_nnan_ninf:4033; VI-GISEL: ; %bb.0:4034; VI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)4035; VI-GISEL-NEXT: v_mov_b32_e32 v2, 04036; VI-GISEL-NEXT: v_bfrev_b32_e32 v3, 84037; VI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]4038; VI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc4039; VI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v24040; VI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v24041; VI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]4042; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.54043; VI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]4044; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.54045; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]4046; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4047; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]4048; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]4049; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]4050; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]4051; VI-GISEL-NEXT: v_mov_b32_e32 v4, 0xffffff804052; VI-GISEL-NEXT: v_mov_b32_e32 v5, 0x2604053; VI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc4054; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v54055; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v44056; VI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc4057; VI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc4058; VI-GISEL-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]4059; VI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.04060; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]4061; VI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.04062; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]4063; VI-GISEL-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], -1.04064; VI-GISEL-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], -v[2:3]4065; VI-GISEL-NEXT: s_setpc_b64 s[30:31]4066 %sqrt = call contract afn nnan ninf double @llvm.sqrt.f64(double %x)4067 %rsq = fdiv contract afn nnan ninf double -1.0, %sqrt4068 ret double %rsq4069}4070 4071define double @v_rsq_f64__nnan_ninf(double %x) {4072; SI-SDAG-LABEL: v_rsq_f64__nnan_ninf:4073; SI-SDAG: ; %bb.0:4074; SI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)4075; SI-SDAG-NEXT: s_mov_b32 s4, 04076; SI-SDAG-NEXT: s_brev_b32 s5, 84077; SI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]4078; SI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1004079; SI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc4080; SI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v24081; SI-SDAG-NEXT: v_mov_b32_e32 v8, 0xffffff804082; SI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]4083; SI-SDAG-NEXT: v_mov_b32_e32 v9, 0x2604084; SI-SDAG-NEXT: s_mov_b32 s6, 0x3ff000004085; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]4086; SI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.54087; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.54088; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4089; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]4090; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]4091; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]4092; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]4093; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]4094; SI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc4095; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v44096; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v94097; SI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc4098; SI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc4099; SI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.04100; SI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]4101; SI-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, v1, v34102; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.04103; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4104; SI-SDAG-NEXT: v_div_scale_f64 v[6:7], s[4:5], 1.0, v[0:1], 1.04105; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.04106; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]4107; SI-SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], s6, v74108; SI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]4109; SI-SDAG-NEXT: s_xor_b64 vcc, s[4:5], vcc4110; SI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]4111; SI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]4112; SI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.04113; SI-SDAG-NEXT: s_setpc_b64 s[30:31]4114;4115; SI-GISEL-LABEL: v_rsq_f64__nnan_ninf:4116; SI-GISEL: ; %bb.0:4117; SI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)4118; SI-GISEL-NEXT: v_mov_b32_e32 v2, 04119; SI-GISEL-NEXT: v_bfrev_b32_e32 v3, 84120; SI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]4121; SI-GISEL-NEXT: v_mov_b32_e32 v8, 0xffffff804122; SI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc4123; SI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v24124; SI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v24125; SI-GISEL-NEXT: v_mov_b32_e32 v9, 0x2604126; SI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]4127; SI-GISEL-NEXT: v_mov_b32_e32 v10, 0x3ff000004128; SI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.54129; SI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]4130; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.54131; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]4132; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4133; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]4134; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]4135; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]4136; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]4137; SI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc4138; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v44139; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v94140; SI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc4141; SI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc4142; SI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.04143; SI-GISEL-NEXT: v_div_scale_f64 v[8:9], s[4:5], 1.0, v[0:1], 1.04144; SI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]4145; SI-GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], v1, v34146; SI-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v9, v104147; SI-GISEL-NEXT: s_xor_b64 vcc, vcc, s[4:5]4148; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.04149; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4150; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.04151; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4152; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[8:9], v[4:5]4153; SI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[6:7], v[8:9]4154; SI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[6:7]4155; SI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.04156; SI-GISEL-NEXT: s_setpc_b64 s[30:31]4157;4158; VI-SDAG-LABEL: v_rsq_f64__nnan_ninf:4159; VI-SDAG: ; %bb.0:4160; VI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)4161; VI-SDAG-NEXT: s_mov_b32 s4, 04162; VI-SDAG-NEXT: s_brev_b32 s5, 84163; VI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]4164; VI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1004165; VI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc4166; VI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v24167; VI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]4168; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]4169; VI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.54170; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.54171; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4172; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]4173; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]4174; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]4175; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]4176; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]4177; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0xffffff804178; VI-SDAG-NEXT: v_mov_b32_e32 v5, 0x2604179; VI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc4180; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v54181; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v44182; VI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc4183; VI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc4184; VI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.04185; VI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]4186; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.04187; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4188; VI-SDAG-NEXT: v_div_scale_f64 v[6:7], vcc, 1.0, v[0:1], 1.04189; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.04190; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]4191; VI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]4192; VI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]4193; VI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]4194; VI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.04195; VI-SDAG-NEXT: s_setpc_b64 s[30:31]4196;4197; VI-GISEL-LABEL: v_rsq_f64__nnan_ninf:4198; VI-GISEL: ; %bb.0:4199; VI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)4200; VI-GISEL-NEXT: v_mov_b32_e32 v2, 04201; VI-GISEL-NEXT: v_bfrev_b32_e32 v3, 84202; VI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]4203; VI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc4204; VI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v24205; VI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v24206; VI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]4207; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.54208; VI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]4209; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.54210; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]4211; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4212; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]4213; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]4214; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]4215; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]4216; VI-GISEL-NEXT: v_mov_b32_e32 v4, 0xffffff804217; VI-GISEL-NEXT: v_mov_b32_e32 v5, 0x2604218; VI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc4219; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v54220; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v44221; VI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc4222; VI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc4223; VI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.04224; VI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]4225; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.04226; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4227; VI-GISEL-NEXT: v_div_scale_f64 v[6:7], vcc, 1.0, v[0:1], 1.04228; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.04229; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]4230; VI-GISEL-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]4231; VI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]4232; VI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]4233; VI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.04234; VI-GISEL-NEXT: s_setpc_b64 s[30:31]4235 %sqrt = call contract nnan ninf double @llvm.sqrt.f64(double %x)4236 %rsq = fdiv contract nnan ninf double 1.0, %sqrt4237 ret double %rsq4238}4239 4240define <2 x double> @v_rsq_v2f64__afn_nnan_ninf(<2 x double> %x) {4241; SI-SDAG-LABEL: v_rsq_v2f64__afn_nnan_ninf:4242; SI-SDAG: ; %bb.0:4243; SI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)4244; SI-SDAG-NEXT: s_mov_b32 s4, 04245; SI-SDAG-NEXT: s_brev_b32 s5, 84246; SI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[2:3]4247; SI-SDAG-NEXT: v_mov_b32_e32 v12, 0x1004248; SI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v12, vcc4249; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v44250; SI-SDAG-NEXT: v_cmp_gt_f64_e64 s[4:5], s[4:5], v[0:1]4251; SI-SDAG-NEXT: v_rsq_f64_e32 v[4:5], v[2:3]4252; SI-SDAG-NEXT: v_mov_b32_e32 v14, 0xffffff804253; SI-SDAG-NEXT: v_mov_b32_e32 v15, 0x2604254; SI-SDAG-NEXT: v_mul_f64 v[6:7], v[2:3], v[4:5]4255; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[4:5], 0.54256; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[4:5], v[6:7], 0.54257; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]4258; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]4259; SI-SDAG-NEXT: v_cndmask_b32_e64 v8, 0, v12, s[4:5]4260; SI-SDAG-NEXT: v_fma_f64 v[10:11], -v[6:7], v[6:7], v[2:3]4261; SI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v84262; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[10:11], v[4:5], v[6:7]4263; SI-SDAG-NEXT: v_rsq_f64_e32 v[8:9], v[0:1]4264; SI-SDAG-NEXT: v_fma_f64 v[10:11], -v[6:7], v[6:7], v[2:3]4265; SI-SDAG-NEXT: v_cndmask_b32_e32 v12, 0, v14, vcc4266; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[10:11], v[4:5], v[6:7]4267; SI-SDAG-NEXT: v_mul_f64 v[6:7], v[0:1], v[8:9]4268; SI-SDAG-NEXT: v_mul_f64 v[8:9], v[8:9], 0.54269; SI-SDAG-NEXT: v_ldexp_f64 v[4:5], v[4:5], v124270; SI-SDAG-NEXT: v_fma_f64 v[10:11], -v[8:9], v[6:7], 0.54271; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[2:3], v154272; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[10:11], v[6:7]4273; SI-SDAG-NEXT: v_fma_f64 v[8:9], v[8:9], v[10:11], v[8:9]4274; SI-SDAG-NEXT: v_fma_f64 v[12:13], -v[6:7], v[6:7], v[0:1]4275; SI-SDAG-NEXT: v_cndmask_b32_e32 v3, v5, v3, vcc4276; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[12:13], v[8:9], v[6:7]4277; SI-SDAG-NEXT: v_cndmask_b32_e32 v2, v4, v2, vcc4278; SI-SDAG-NEXT: v_fma_f64 v[10:11], -v[6:7], v[6:7], v[0:1]4279; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v154280; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[10:11], v[8:9], v[6:7]4281; SI-SDAG-NEXT: v_cndmask_b32_e64 v6, 0, v14, s[4:5]4282; SI-SDAG-NEXT: v_ldexp_f64 v[4:5], v[4:5], v64283; SI-SDAG-NEXT: v_rcp_f64_e32 v[6:7], v[2:3]4284; SI-SDAG-NEXT: v_cndmask_b32_e32 v1, v5, v1, vcc4285; SI-SDAG-NEXT: v_cndmask_b32_e32 v0, v4, v0, vcc4286; SI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[0:1]4287; SI-SDAG-NEXT: v_fma_f64 v[10:11], -v[2:3], v[6:7], 1.04288; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[10:11], v[6:7], v[6:7]4289; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[0:1], v[4:5], 1.04290; SI-SDAG-NEXT: v_fma_f64 v[10:11], -v[2:3], v[6:7], 1.04291; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[8:9], v[4:5], v[4:5]4292; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[10:11], v[6:7], v[6:7]4293; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[0:1], v[4:5], 1.04294; SI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[6:7], 1.04295; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[8:9], v[4:5], v[4:5]4296; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[6:7]4297; SI-SDAG-NEXT: v_fma_f64 v[0:1], -v[0:1], v[4:5], 1.04298; SI-SDAG-NEXT: v_fma_f64 v[0:1], v[0:1], v[4:5], v[4:5]4299; SI-SDAG-NEXT: s_setpc_b64 s[30:31]4300;4301; SI-GISEL-LABEL: v_rsq_v2f64__afn_nnan_ninf:4302; SI-GISEL: ; %bb.0:4303; SI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)4304; SI-GISEL-NEXT: v_mov_b32_e32 v4, 04305; SI-GISEL-NEXT: v_bfrev_b32_e32 v5, 84306; SI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[4:5]4307; SI-GISEL-NEXT: v_cmp_lt_f64_e64 s[4:5], v[2:3], v[4:5]4308; SI-GISEL-NEXT: v_cndmask_b32_e64 v6, 0, 1, vcc4309; SI-GISEL-NEXT: v_lshlrev_b32_e32 v6, 8, v64310; SI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v64311; SI-GISEL-NEXT: v_cndmask_b32_e64 v12, 0, 1, s[4:5]4312; SI-GISEL-NEXT: v_rsq_f64_e32 v[6:7], v[0:1]4313; SI-GISEL-NEXT: v_mul_f64 v[8:9], v[6:7], 0.54314; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[0:1], v[6:7]4315; SI-GISEL-NEXT: v_fma_f64 v[10:11], -v[8:9], v[6:7], 0.54316; SI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[10:11], v[6:7]4317; SI-GISEL-NEXT: v_fma_f64 v[8:9], v[8:9], v[10:11], v[8:9]4318; SI-GISEL-NEXT: v_fma_f64 v[10:11], -v[6:7], v[6:7], v[0:1]4319; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[10:11], v[8:9], v[6:7]4320; SI-GISEL-NEXT: v_lshlrev_b32_e32 v6, 8, v124321; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v64322; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]4323; SI-GISEL-NEXT: v_rsq_f64_e32 v[10:11], v[2:3]4324; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[6:7], v[8:9], v[4:5]4325; SI-GISEL-NEXT: v_mov_b32_e32 v12, 0xffffff804326; SI-GISEL-NEXT: v_cndmask_b32_e32 v13, 0, v12, vcc4327; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[10:11], 0.54328; SI-GISEL-NEXT: v_mul_f64 v[8:9], v[2:3], v[10:11]4329; SI-GISEL-NEXT: v_ldexp_f64 v[4:5], v[4:5], v134330; SI-GISEL-NEXT: v_fma_f64 v[10:11], -v[6:7], v[8:9], 0.54331; SI-GISEL-NEXT: v_mov_b32_e32 v13, 0x2604332; SI-GISEL-NEXT: v_fma_f64 v[8:9], v[8:9], v[10:11], v[8:9]4333; SI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[10:11], v[6:7]4334; SI-GISEL-NEXT: v_fma_f64 v[10:11], -v[8:9], v[8:9], v[2:3]4335; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v134336; SI-GISEL-NEXT: v_fma_f64 v[8:9], v[10:11], v[6:7], v[8:9]4337; SI-GISEL-NEXT: v_cndmask_b32_e32 v0, v4, v0, vcc4338; SI-GISEL-NEXT: v_fma_f64 v[10:11], -v[8:9], v[8:9], v[2:3]4339; SI-GISEL-NEXT: v_cndmask_b32_e32 v1, v5, v1, vcc4340; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[10:11], v[6:7], v[8:9]4341; SI-GISEL-NEXT: v_cndmask_b32_e64 v6, 0, v12, s[4:5]4342; SI-GISEL-NEXT: v_ldexp_f64 v[4:5], v[4:5], v64343; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[2:3], v134344; SI-GISEL-NEXT: v_cndmask_b32_e32 v2, v4, v2, vcc4345; SI-GISEL-NEXT: v_cndmask_b32_e32 v3, v5, v3, vcc4346; SI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[0:1]4347; SI-GISEL-NEXT: v_rcp_f64_e32 v[6:7], v[2:3]4348; SI-GISEL-NEXT: v_fma_f64 v[8:9], -v[0:1], v[4:5], 1.04349; SI-GISEL-NEXT: v_fma_f64 v[10:11], -v[2:3], v[6:7], 1.04350; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[8:9], v[4:5], v[4:5]4351; SI-GISEL-NEXT: v_fma_f64 v[6:7], v[10:11], v[6:7], v[6:7]4352; SI-GISEL-NEXT: v_fma_f64 v[8:9], -v[0:1], v[4:5], 1.04353; SI-GISEL-NEXT: v_fma_f64 v[10:11], -v[2:3], v[6:7], 1.04354; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[8:9], v[4:5], v[4:5]4355; SI-GISEL-NEXT: v_fma_f64 v[6:7], v[10:11], v[6:7], v[6:7]4356; SI-GISEL-NEXT: v_fma_f64 v[0:1], -v[0:1], v[4:5], 1.04357; SI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[6:7], 1.04358; SI-GISEL-NEXT: v_fma_f64 v[0:1], v[0:1], v[4:5], v[4:5]4359; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[6:7]4360; SI-GISEL-NEXT: s_setpc_b64 s[30:31]4361;4362; VI-SDAG-LABEL: v_rsq_v2f64__afn_nnan_ninf:4363; VI-SDAG: ; %bb.0:4364; VI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)4365; VI-SDAG-NEXT: s_mov_b32 s4, 04366; VI-SDAG-NEXT: s_brev_b32 s5, 84367; VI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[2:3]4368; VI-SDAG-NEXT: v_cmp_gt_f64_e64 s[4:5], s[4:5], v[0:1]4369; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0x1004370; VI-SDAG-NEXT: v_cndmask_b32_e32 v5, 0, v4, vcc4371; VI-SDAG-NEXT: v_cndmask_b32_e64 v4, 0, v4, s[4:5]4372; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v54373; VI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v44374; VI-SDAG-NEXT: v_rsq_f64_e32 v[4:5], v[2:3]4375; VI-SDAG-NEXT: v_rsq_f64_e32 v[6:7], v[0:1]4376; VI-SDAG-NEXT: v_mul_f64 v[8:9], v[2:3], v[4:5]4377; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[4:5], 0.54378; VI-SDAG-NEXT: v_mul_f64 v[10:11], v[0:1], v[6:7]4379; VI-SDAG-NEXT: v_mul_f64 v[6:7], v[6:7], 0.54380; VI-SDAG-NEXT: v_fma_f64 v[12:13], -v[4:5], v[8:9], 0.54381; VI-SDAG-NEXT: v_fma_f64 v[14:15], -v[6:7], v[10:11], 0.54382; VI-SDAG-NEXT: v_fma_f64 v[8:9], v[8:9], v[12:13], v[8:9]4383; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[12:13], v[4:5]4384; VI-SDAG-NEXT: v_fma_f64 v[10:11], v[10:11], v[14:15], v[10:11]4385; VI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[14:15], v[6:7]4386; VI-SDAG-NEXT: v_fma_f64 v[12:13], -v[8:9], v[8:9], v[2:3]4387; VI-SDAG-NEXT: v_fma_f64 v[14:15], -v[10:11], v[10:11], v[0:1]4388; VI-SDAG-NEXT: v_fma_f64 v[8:9], v[12:13], v[4:5], v[8:9]4389; VI-SDAG-NEXT: v_fma_f64 v[10:11], v[14:15], v[6:7], v[10:11]4390; VI-SDAG-NEXT: v_fma_f64 v[12:13], -v[8:9], v[8:9], v[2:3]4391; VI-SDAG-NEXT: v_fma_f64 v[14:15], -v[10:11], v[10:11], v[0:1]4392; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[12:13], v[4:5], v[8:9]4393; VI-SDAG-NEXT: v_mov_b32_e32 v8, 0xffffff804394; VI-SDAG-NEXT: v_fma_f64 v[6:7], v[14:15], v[6:7], v[10:11]4395; VI-SDAG-NEXT: v_mov_b32_e32 v9, 0x2604396; VI-SDAG-NEXT: v_cndmask_b32_e32 v10, 0, v8, vcc4397; VI-SDAG-NEXT: v_cndmask_b32_e64 v8, 0, v8, s[4:5]4398; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v94399; VI-SDAG-NEXT: v_cmp_class_f64_e64 s[4:5], v[2:3], v94400; VI-SDAG-NEXT: v_ldexp_f64 v[4:5], v[4:5], v104401; VI-SDAG-NEXT: v_ldexp_f64 v[6:7], v[6:7], v84402; VI-SDAG-NEXT: v_cndmask_b32_e64 v3, v5, v3, s[4:5]4403; VI-SDAG-NEXT: v_cndmask_b32_e64 v2, v4, v2, s[4:5]4404; VI-SDAG-NEXT: v_cndmask_b32_e32 v1, v7, v1, vcc4405; VI-SDAG-NEXT: v_cndmask_b32_e32 v0, v6, v0, vcc4406; VI-SDAG-NEXT: v_rcp_f64_e32 v[5:6], v[0:1]4407; VI-SDAG-NEXT: v_rcp_f64_e32 v[7:8], v[2:3]4408; VI-SDAG-NEXT: v_fma_f64 v[9:10], -v[0:1], v[5:6], 1.04409; VI-SDAG-NEXT: v_fma_f64 v[11:12], -v[2:3], v[7:8], 1.04410; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[9:10], v[5:6], v[5:6]4411; VI-SDAG-NEXT: v_fma_f64 v[6:7], v[11:12], v[7:8], v[7:8]4412; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[0:1], v[4:5], 1.04413; VI-SDAG-NEXT: v_fma_f64 v[10:11], -v[2:3], v[6:7], 1.04414; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[8:9], v[4:5], v[4:5]4415; VI-SDAG-NEXT: v_fma_f64 v[6:7], v[10:11], v[6:7], v[6:7]4416; VI-SDAG-NEXT: v_fma_f64 v[0:1], -v[0:1], v[4:5], 1.04417; VI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[6:7], 1.04418; VI-SDAG-NEXT: v_fma_f64 v[0:1], v[0:1], v[4:5], v[4:5]4419; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[6:7]4420; VI-SDAG-NEXT: s_setpc_b64 s[30:31]4421;4422; VI-GISEL-LABEL: v_rsq_v2f64__afn_nnan_ninf:4423; VI-GISEL: ; %bb.0:4424; VI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)4425; VI-GISEL-NEXT: v_mov_b32_e32 v4, 04426; VI-GISEL-NEXT: v_bfrev_b32_e32 v5, 84427; VI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[4:5]4428; VI-GISEL-NEXT: v_cmp_lt_f64_e64 s[4:5], v[2:3], v[4:5]4429; VI-GISEL-NEXT: v_cndmask_b32_e64 v6, 0, 1, vcc4430; VI-GISEL-NEXT: v_cndmask_b32_e64 v4, 0, 1, s[4:5]4431; VI-GISEL-NEXT: v_lshlrev_b32_e32 v6, 8, v64432; VI-GISEL-NEXT: v_lshlrev_b32_e32 v4, 8, v44433; VI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v64434; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v44435; VI-GISEL-NEXT: v_rsq_f64_e32 v[4:5], v[0:1]4436; VI-GISEL-NEXT: v_rsq_f64_e32 v[6:7], v[2:3]4437; VI-GISEL-NEXT: v_mul_f64 v[8:9], v[4:5], 0.54438; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[0:1], v[4:5]4439; VI-GISEL-NEXT: v_mul_f64 v[10:11], v[6:7], 0.54440; VI-GISEL-NEXT: v_mul_f64 v[6:7], v[2:3], v[6:7]4441; VI-GISEL-NEXT: v_fma_f64 v[12:13], -v[8:9], v[4:5], 0.54442; VI-GISEL-NEXT: v_fma_f64 v[14:15], -v[10:11], v[6:7], 0.54443; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[12:13], v[4:5]4444; VI-GISEL-NEXT: v_fma_f64 v[8:9], v[8:9], v[12:13], v[8:9]4445; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[14:15], v[6:7]4446; VI-GISEL-NEXT: v_fma_f64 v[10:11], v[10:11], v[14:15], v[10:11]4447; VI-GISEL-NEXT: v_fma_f64 v[12:13], -v[4:5], v[4:5], v[0:1]4448; VI-GISEL-NEXT: v_fma_f64 v[14:15], -v[6:7], v[6:7], v[2:3]4449; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[12:13], v[8:9], v[4:5]4450; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[14:15], v[10:11], v[6:7]4451; VI-GISEL-NEXT: v_fma_f64 v[12:13], -v[4:5], v[4:5], v[0:1]4452; VI-GISEL-NEXT: v_fma_f64 v[14:15], -v[6:7], v[6:7], v[2:3]4453; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[12:13], v[8:9], v[4:5]4454; VI-GISEL-NEXT: v_mov_b32_e32 v8, 0xffffff804455; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[14:15], v[10:11], v[6:7]4456; VI-GISEL-NEXT: v_mov_b32_e32 v9, 0x2604457; VI-GISEL-NEXT: v_cndmask_b32_e32 v10, 0, v8, vcc4458; VI-GISEL-NEXT: v_cndmask_b32_e64 v8, 0, v8, s[4:5]4459; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v94460; VI-GISEL-NEXT: v_cmp_class_f64_e64 s[4:5], v[2:3], v94461; VI-GISEL-NEXT: v_ldexp_f64 v[4:5], v[4:5], v104462; VI-GISEL-NEXT: v_ldexp_f64 v[6:7], v[6:7], v84463; VI-GISEL-NEXT: v_cndmask_b32_e32 v0, v4, v0, vcc4464; VI-GISEL-NEXT: v_cndmask_b32_e32 v1, v5, v1, vcc4465; VI-GISEL-NEXT: v_cndmask_b32_e64 v2, v6, v2, s[4:5]4466; VI-GISEL-NEXT: v_cndmask_b32_e64 v3, v7, v3, s[4:5]4467; VI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[0:1]4468; VI-GISEL-NEXT: v_rcp_f64_e32 v[6:7], v[2:3]4469; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[0:1], v[4:5], 1.04470; VI-GISEL-NEXT: v_fma_f64 v[10:11], -v[2:3], v[6:7], 1.04471; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[8:9], v[4:5], v[4:5]4472; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[10:11], v[6:7], v[6:7]4473; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[0:1], v[4:5], 1.04474; VI-GISEL-NEXT: v_fma_f64 v[10:11], -v[2:3], v[6:7], 1.04475; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[8:9], v[4:5], v[4:5]4476; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[10:11], v[6:7], v[6:7]4477; VI-GISEL-NEXT: v_fma_f64 v[0:1], -v[0:1], v[4:5], 1.04478; VI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[6:7], 1.04479; VI-GISEL-NEXT: v_fma_f64 v[0:1], v[0:1], v[4:5], v[4:5]4480; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[6:7]4481; VI-GISEL-NEXT: s_setpc_b64 s[30:31]4482 %sqrt = call contract afn nnan ninf <2 x double> @llvm.sqrt.v2f64(<2 x double> %x)4483 %rsq = fdiv contract afn nnan ninf <2 x double> <double 1.0, double 1.0>, %sqrt4484 ret <2 x double> %rsq4485}4486 4487define amdgpu_ps <2 x i32> @s_rsq_f64_unsafe(double inreg %x) {4488; SI-SDAG-LABEL: s_rsq_f64_unsafe:4489; SI-SDAG: ; %bb.0:4490; SI-SDAG-NEXT: v_mov_b32_e32 v0, 04491; SI-SDAG-NEXT: v_bfrev_b32_e32 v1, 84492; SI-SDAG-NEXT: v_cmp_lt_f64_e32 vcc, s[0:1], v[0:1]4493; SI-SDAG-NEXT: v_mov_b32_e32 v8, 0x2604494; SI-SDAG-NEXT: s_and_b64 s[2:3], vcc, exec4495; SI-SDAG-NEXT: s_cselect_b32 s2, 0x100, 04496; SI-SDAG-NEXT: v_mov_b32_e32 v0, s24497; SI-SDAG-NEXT: v_ldexp_f64 v[0:1], s[0:1], v04498; SI-SDAG-NEXT: s_cselect_b32 s0, 0xffffff80, 04499; SI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]4500; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v84501; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]4502; SI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.54503; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.54504; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4505; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]4506; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]4507; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]4508; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]4509; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]4510; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], s04511; SI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc4512; SI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc4513; SI-SDAG-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]4514; SI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.04515; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]4516; SI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.04517; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]4518; SI-SDAG-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.04519; SI-SDAG-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]4520; SI-SDAG-NEXT: v_readfirstlane_b32 s0, v04521; SI-SDAG-NEXT: v_readfirstlane_b32 s1, v14522; SI-SDAG-NEXT: ; return to shader part epilog4523;4524; SI-GISEL-LABEL: s_rsq_f64_unsafe:4525; SI-GISEL: ; %bb.0:4526; SI-GISEL-NEXT: v_mov_b32_e32 v0, 04527; SI-GISEL-NEXT: v_bfrev_b32_e32 v1, 84528; SI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, s[0:1], v[0:1]4529; SI-GISEL-NEXT: v_mov_b32_e32 v8, 0xffffff804530; SI-GISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc4531; SI-GISEL-NEXT: v_lshlrev_b32_e32 v0, 8, v04532; SI-GISEL-NEXT: v_ldexp_f64 v[0:1], s[0:1], v04533; SI-GISEL-NEXT: v_mov_b32_e32 v9, 0x2604534; SI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]4535; SI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.54536; SI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]4537; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.54538; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]4539; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4540; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]4541; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]4542; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]4543; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]4544; SI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc4545; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v44546; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v94547; SI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc4548; SI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc4549; SI-GISEL-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]4550; SI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.04551; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]4552; SI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.04553; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]4554; SI-GISEL-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.04555; SI-GISEL-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]4556; SI-GISEL-NEXT: v_readfirstlane_b32 s0, v04557; SI-GISEL-NEXT: v_readfirstlane_b32 s1, v14558; SI-GISEL-NEXT: ; return to shader part epilog4559;4560; VI-SDAG-LABEL: s_rsq_f64_unsafe:4561; VI-SDAG: ; %bb.0:4562; VI-SDAG-NEXT: v_mov_b32_e32 v0, 04563; VI-SDAG-NEXT: v_bfrev_b32_e32 v1, 84564; VI-SDAG-NEXT: v_cmp_lt_f64_e32 vcc, s[0:1], v[0:1]4565; VI-SDAG-NEXT: s_and_b64 s[2:3], vcc, exec4566; VI-SDAG-NEXT: s_cselect_b32 s2, 0x100, 04567; VI-SDAG-NEXT: v_mov_b32_e32 v0, s24568; VI-SDAG-NEXT: v_ldexp_f64 v[0:1], s[0:1], v04569; VI-SDAG-NEXT: s_cselect_b32 s0, 0xffffff80, 04570; VI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]4571; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]4572; VI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.54573; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.54574; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4575; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]4576; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]4577; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]4578; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]4579; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]4580; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0x2604581; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v44582; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], s04583; VI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc4584; VI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc4585; VI-SDAG-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]4586; VI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.04587; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]4588; VI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.04589; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]4590; VI-SDAG-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.04591; VI-SDAG-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]4592; VI-SDAG-NEXT: v_readfirstlane_b32 s0, v04593; VI-SDAG-NEXT: v_readfirstlane_b32 s1, v14594; VI-SDAG-NEXT: ; return to shader part epilog4595;4596; VI-GISEL-LABEL: s_rsq_f64_unsafe:4597; VI-GISEL: ; %bb.0:4598; VI-GISEL-NEXT: v_mov_b32_e32 v0, 04599; VI-GISEL-NEXT: v_bfrev_b32_e32 v1, 84600; VI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, s[0:1], v[0:1]4601; VI-GISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc4602; VI-GISEL-NEXT: v_lshlrev_b32_e32 v0, 8, v04603; VI-GISEL-NEXT: v_ldexp_f64 v[0:1], s[0:1], v04604; VI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]4605; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.54606; VI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]4607; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.54608; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]4609; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4610; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]4611; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]4612; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]4613; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]4614; VI-GISEL-NEXT: v_mov_b32_e32 v4, 0xffffff804615; VI-GISEL-NEXT: v_mov_b32_e32 v5, 0x2604616; VI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc4617; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v54618; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v44619; VI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc4620; VI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc4621; VI-GISEL-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]4622; VI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.04623; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]4624; VI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.04625; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]4626; VI-GISEL-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.04627; VI-GISEL-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]4628; VI-GISEL-NEXT: v_readfirstlane_b32 s0, v04629; VI-GISEL-NEXT: v_readfirstlane_b32 s1, v14630; VI-GISEL-NEXT: ; return to shader part epilog4631 %rsq = call contract afn double @llvm.sqrt.f64(double %x)4632 %result = fdiv contract afn double 1.0, %rsq4633 %cast = bitcast double %result to <2 x i32>4634 %cast.0 = extractelement <2 x i32> %cast, i32 04635 %cast.1 = extractelement <2 x i32> %cast, i32 14636 %lane.0 = call i32 @llvm.amdgcn.readfirstlane(i32 %cast.0)4637 %lane.1 = call i32 @llvm.amdgcn.readfirstlane(i32 %cast.1)4638 %insert.0 = insertelement <2 x i32> poison, i32 %lane.0, i32 04639 %insert.1 = insertelement <2 x i32> %insert.0, i32 %lane.1, i32 14640 ret <2 x i32> %insert.14641}4642 4643define double @v_rsq_f64_unsafe(double %x) {4644; SI-SDAG-LABEL: v_rsq_f64_unsafe:4645; SI-SDAG: ; %bb.0:4646; SI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)4647; SI-SDAG-NEXT: s_mov_b32 s4, 04648; SI-SDAG-NEXT: s_brev_b32 s5, 84649; SI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]4650; SI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1004651; SI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc4652; SI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v24653; SI-SDAG-NEXT: v_mov_b32_e32 v8, 0xffffff804654; SI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]4655; SI-SDAG-NEXT: v_mov_b32_e32 v9, 0x2604656; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]4657; SI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.54658; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.54659; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4660; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]4661; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]4662; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]4663; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]4664; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]4665; SI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc4666; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v44667; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v94668; SI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc4669; SI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc4670; SI-SDAG-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]4671; SI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.04672; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]4673; SI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.04674; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]4675; SI-SDAG-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.04676; SI-SDAG-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]4677; SI-SDAG-NEXT: s_setpc_b64 s[30:31]4678;4679; SI-GISEL-LABEL: v_rsq_f64_unsafe:4680; SI-GISEL: ; %bb.0:4681; SI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)4682; SI-GISEL-NEXT: v_mov_b32_e32 v2, 04683; SI-GISEL-NEXT: v_bfrev_b32_e32 v3, 84684; SI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]4685; SI-GISEL-NEXT: v_mov_b32_e32 v8, 0xffffff804686; SI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc4687; SI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v24688; SI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v24689; SI-GISEL-NEXT: v_mov_b32_e32 v9, 0x2604690; SI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]4691; SI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.54692; SI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]4693; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.54694; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]4695; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4696; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]4697; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]4698; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]4699; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]4700; SI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc4701; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v44702; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v94703; SI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc4704; SI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc4705; SI-GISEL-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]4706; SI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.04707; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]4708; SI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.04709; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]4710; SI-GISEL-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.04711; SI-GISEL-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]4712; SI-GISEL-NEXT: s_setpc_b64 s[30:31]4713;4714; VI-SDAG-LABEL: v_rsq_f64_unsafe:4715; VI-SDAG: ; %bb.0:4716; VI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)4717; VI-SDAG-NEXT: s_mov_b32 s4, 04718; VI-SDAG-NEXT: s_brev_b32 s5, 84719; VI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]4720; VI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1004721; VI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc4722; VI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v24723; VI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]4724; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]4725; VI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.54726; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.54727; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4728; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]4729; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]4730; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]4731; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]4732; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]4733; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0xffffff804734; VI-SDAG-NEXT: v_mov_b32_e32 v5, 0x2604735; VI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc4736; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v54737; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v44738; VI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc4739; VI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc4740; VI-SDAG-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]4741; VI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.04742; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]4743; VI-SDAG-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.04744; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]4745; VI-SDAG-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.04746; VI-SDAG-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]4747; VI-SDAG-NEXT: s_setpc_b64 s[30:31]4748;4749; VI-GISEL-LABEL: v_rsq_f64_unsafe:4750; VI-GISEL: ; %bb.0:4751; VI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)4752; VI-GISEL-NEXT: v_mov_b32_e32 v2, 04753; VI-GISEL-NEXT: v_bfrev_b32_e32 v3, 84754; VI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]4755; VI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc4756; VI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v24757; VI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v24758; VI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]4759; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.54760; VI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]4761; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.54762; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]4763; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4764; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]4765; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]4766; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]4767; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]4768; VI-GISEL-NEXT: v_mov_b32_e32 v4, 0xffffff804769; VI-GISEL-NEXT: v_mov_b32_e32 v5, 0x2604770; VI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc4771; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v54772; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v44773; VI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc4774; VI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc4775; VI-GISEL-NEXT: v_rcp_f64_e32 v[2:3], v[0:1]4776; VI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.04777; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]4778; VI-GISEL-NEXT: v_fma_f64 v[4:5], -v[0:1], v[2:3], 1.04779; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[4:5], v[2:3], v[2:3]4780; VI-GISEL-NEXT: v_fma_f64 v[0:1], -v[0:1], v[2:3], 1.04781; VI-GISEL-NEXT: v_fma_f64 v[0:1], v[0:1], v[2:3], v[2:3]4782; VI-GISEL-NEXT: s_setpc_b64 s[30:31]4783 %sqrt = call afn contract double @llvm.sqrt.f64(double %x)4784 %rsq = fdiv afn contract double 1.0, %sqrt4785 ret double %rsq4786}4787 4788define double @v_rsq_amdgcn_sqrt_f64(double %x) {4789; SI-SDAG-LABEL: v_rsq_amdgcn_sqrt_f64:4790; SI-SDAG: ; %bb.0:4791; SI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)4792; SI-SDAG-NEXT: v_sqrt_f64_e32 v[0:1], v[0:1]4793; SI-SDAG-NEXT: s_mov_b32 s6, 0x3ff000004794; SI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.04795; SI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]4796; SI-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, v1, v34797; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.04798; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4799; SI-SDAG-NEXT: v_div_scale_f64 v[6:7], s[4:5], 1.0, v[0:1], 1.04800; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.04801; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]4802; SI-SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], s6, v74803; SI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]4804; SI-SDAG-NEXT: s_xor_b64 vcc, s[4:5], vcc4805; SI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]4806; SI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]4807; SI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.04808; SI-SDAG-NEXT: s_setpc_b64 s[30:31]4809;4810; SI-GISEL-LABEL: v_rsq_amdgcn_sqrt_f64:4811; SI-GISEL: ; %bb.0:4812; SI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)4813; SI-GISEL-NEXT: v_sqrt_f64_e32 v[0:1], v[0:1]4814; SI-GISEL-NEXT: v_mov_b32_e32 v10, 0x3ff000004815; SI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.04816; SI-GISEL-NEXT: v_div_scale_f64 v[8:9], s[4:5], 1.0, v[0:1], 1.04817; SI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]4818; SI-GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], v1, v34819; SI-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v9, v104820; SI-GISEL-NEXT: s_xor_b64 vcc, vcc, s[4:5]4821; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.04822; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4823; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.04824; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4825; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[8:9], v[4:5]4826; SI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[6:7], v[8:9]4827; SI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[6:7]4828; SI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.04829; SI-GISEL-NEXT: s_setpc_b64 s[30:31]4830;4831; VI-SDAG-LABEL: v_rsq_amdgcn_sqrt_f64:4832; VI-SDAG: ; %bb.0:4833; VI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)4834; VI-SDAG-NEXT: v_sqrt_f64_e32 v[0:1], v[0:1]4835; VI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.04836; VI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]4837; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.04838; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4839; VI-SDAG-NEXT: v_div_scale_f64 v[6:7], vcc, 1.0, v[0:1], 1.04840; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.04841; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]4842; VI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]4843; VI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]4844; VI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]4845; VI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.04846; VI-SDAG-NEXT: s_setpc_b64 s[30:31]4847;4848; VI-GISEL-LABEL: v_rsq_amdgcn_sqrt_f64:4849; VI-GISEL: ; %bb.0:4850; VI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)4851; VI-GISEL-NEXT: v_sqrt_f64_e32 v[0:1], v[0:1]4852; VI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], 1.04853; VI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]4854; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.04855; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4856; VI-GISEL-NEXT: v_div_scale_f64 v[6:7], vcc, 1.0, v[0:1], 1.04857; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.04858; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]4859; VI-GISEL-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]4860; VI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]4861; VI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]4862; VI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.04863; VI-GISEL-NEXT: s_setpc_b64 s[30:31]4864 %sqrt = call contract double @llvm.amdgcn.sqrt.f64(double %x)4865 %rsq = fdiv contract double 1.0, %sqrt4866 ret double %rsq4867}4868 4869define double @v_neg_rsq_amdgcn_sqrt_f64(double %x) {4870; SI-SDAG-LABEL: v_neg_rsq_amdgcn_sqrt_f64:4871; SI-SDAG: ; %bb.0:4872; SI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)4873; SI-SDAG-NEXT: v_sqrt_f64_e32 v[0:1], v[0:1]4874; SI-SDAG-NEXT: s_mov_b32 s6, 0xbff000004875; SI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], -1.04876; SI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]4877; SI-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, v1, v34878; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.04879; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4880; SI-SDAG-NEXT: v_div_scale_f64 v[6:7], s[4:5], -1.0, v[0:1], -1.04881; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.04882; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]4883; SI-SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], s6, v74884; SI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]4885; SI-SDAG-NEXT: s_xor_b64 vcc, s[4:5], vcc4886; SI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]4887; SI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]4888; SI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], -1.04889; SI-SDAG-NEXT: s_setpc_b64 s[30:31]4890;4891; SI-GISEL-LABEL: v_neg_rsq_amdgcn_sqrt_f64:4892; SI-GISEL: ; %bb.0:4893; SI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)4894; SI-GISEL-NEXT: v_sqrt_f64_e32 v[0:1], v[0:1]4895; SI-GISEL-NEXT: v_mov_b32_e32 v10, 0xbff000004896; SI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], -1.04897; SI-GISEL-NEXT: v_div_scale_f64 v[8:9], s[4:5], -1.0, v[0:1], -1.04898; SI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]4899; SI-GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], v1, v34900; SI-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v9, v104901; SI-GISEL-NEXT: s_xor_b64 vcc, vcc, s[4:5]4902; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.04903; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4904; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.04905; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4906; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[8:9], v[4:5]4907; SI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[6:7], v[8:9]4908; SI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[6:7]4909; SI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], -1.04910; SI-GISEL-NEXT: s_setpc_b64 s[30:31]4911;4912; VI-SDAG-LABEL: v_neg_rsq_amdgcn_sqrt_f64:4913; VI-SDAG: ; %bb.0:4914; VI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)4915; VI-SDAG-NEXT: v_sqrt_f64_e32 v[0:1], v[0:1]4916; VI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], -1.04917; VI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]4918; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.04919; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4920; VI-SDAG-NEXT: v_div_scale_f64 v[6:7], vcc, -1.0, v[0:1], -1.04921; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.04922; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]4923; VI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]4924; VI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]4925; VI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]4926; VI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], -1.04927; VI-SDAG-NEXT: s_setpc_b64 s[30:31]4928;4929; VI-GISEL-LABEL: v_neg_rsq_amdgcn_sqrt_f64:4930; VI-GISEL: ; %bb.0:4931; VI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)4932; VI-GISEL-NEXT: v_sqrt_f64_e32 v[0:1], v[0:1]4933; VI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], -1.04934; VI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]4935; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.04936; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4937; VI-GISEL-NEXT: v_div_scale_f64 v[6:7], vcc, -1.0, v[0:1], -1.04938; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.04939; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]4940; VI-GISEL-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]4941; VI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]4942; VI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]4943; VI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], -1.04944; VI-GISEL-NEXT: s_setpc_b64 s[30:31]4945 %sqrt = call contract double @llvm.amdgcn.sqrt.f64(double %x)4946 %rsq = fdiv contract double -1.0, %sqrt4947 ret double %rsq4948}4949 4950define amdgpu_ps <2 x i32> @s_rsq_amdgcn_sqrt_f64(double inreg %x) {4951; SI-SDAG-LABEL: s_rsq_amdgcn_sqrt_f64:4952; SI-SDAG: ; %bb.0:4953; SI-SDAG-NEXT: v_sqrt_f64_e32 v[0:1], s[0:1]4954; SI-SDAG-NEXT: s_mov_b32 s2, 0x3ff000004955; SI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[0:1], v[0:1], v[0:1], 1.04956; SI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]4957; SI-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, v1, v34958; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.04959; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4960; SI-SDAG-NEXT: v_div_scale_f64 v[6:7], s[0:1], 1.0, v[0:1], 1.04961; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.04962; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]4963; SI-SDAG-NEXT: v_cmp_eq_u32_e64 s[0:1], s2, v74964; SI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]4965; SI-SDAG-NEXT: s_xor_b64 vcc, s[0:1], vcc4966; SI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]4967; SI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]4968; SI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.04969; SI-SDAG-NEXT: v_readfirstlane_b32 s0, v04970; SI-SDAG-NEXT: v_readfirstlane_b32 s1, v14971; SI-SDAG-NEXT: ; return to shader part epilog4972;4973; SI-GISEL-LABEL: s_rsq_amdgcn_sqrt_f64:4974; SI-GISEL: ; %bb.0:4975; SI-GISEL-NEXT: v_sqrt_f64_e32 v[0:1], s[0:1]4976; SI-GISEL-NEXT: v_mov_b32_e32 v10, 0x3ff000004977; SI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[0:1], v[0:1], v[0:1], 1.04978; SI-GISEL-NEXT: v_div_scale_f64 v[8:9], s[0:1], 1.0, v[0:1], 1.04979; SI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]4980; SI-GISEL-NEXT: v_cmp_eq_u32_e64 s[0:1], v1, v34981; SI-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v9, v104982; SI-GISEL-NEXT: s_xor_b64 vcc, vcc, s[0:1]4983; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.04984; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4985; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.04986; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]4987; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[8:9], v[4:5]4988; SI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[6:7], v[8:9]4989; SI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[6:7]4990; SI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.04991; SI-GISEL-NEXT: v_readfirstlane_b32 s0, v04992; SI-GISEL-NEXT: v_readfirstlane_b32 s1, v14993; SI-GISEL-NEXT: ; return to shader part epilog4994;4995; VI-SDAG-LABEL: s_rsq_amdgcn_sqrt_f64:4996; VI-SDAG: ; %bb.0:4997; VI-SDAG-NEXT: v_sqrt_f64_e32 v[0:1], s[0:1]4998; VI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[0:1], v[0:1], v[0:1], 1.04999; VI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]5000; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.05001; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]5002; VI-SDAG-NEXT: v_div_scale_f64 v[6:7], vcc, 1.0, v[0:1], 1.05003; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.05004; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]5005; VI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]5006; VI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]5007; VI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]5008; VI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.05009; VI-SDAG-NEXT: v_readfirstlane_b32 s0, v05010; VI-SDAG-NEXT: v_readfirstlane_b32 s1, v15011; VI-SDAG-NEXT: ; return to shader part epilog5012;5013; VI-GISEL-LABEL: s_rsq_amdgcn_sqrt_f64:5014; VI-GISEL: ; %bb.0:5015; VI-GISEL-NEXT: v_sqrt_f64_e32 v[0:1], s[0:1]5016; VI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[0:1], v[0:1], v[0:1], 1.05017; VI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]5018; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.05019; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]5020; VI-GISEL-NEXT: v_div_scale_f64 v[6:7], vcc, 1.0, v[0:1], 1.05021; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.05022; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]5023; VI-GISEL-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]5024; VI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]5025; VI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]5026; VI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], 1.05027; VI-GISEL-NEXT: v_readfirstlane_b32 s0, v05028; VI-GISEL-NEXT: v_readfirstlane_b32 s1, v15029; VI-GISEL-NEXT: ; return to shader part epilog5030 %rsq = call contract double @llvm.amdgcn.sqrt.f64(double %x)5031 %result = fdiv contract double 1.0, %rsq5032 %cast = bitcast double %result to <2 x i32>5033 %cast.0 = extractelement <2 x i32> %cast, i32 05034 %cast.1 = extractelement <2 x i32> %cast, i32 15035 %lane.0 = call i32 @llvm.amdgcn.readfirstlane(i32 %cast.0)5036 %lane.1 = call i32 @llvm.amdgcn.readfirstlane(i32 %cast.1)5037 %insert.0 = insertelement <2 x i32> poison, i32 %lane.0, i32 05038 %insert.1 = insertelement <2 x i32> %insert.0, i32 %lane.1, i32 15039 ret <2 x i32> %insert.15040}5041 5042define double @v_div_contract_sqrt_f64(double %x, double %y) {5043; SI-SDAG-LABEL: v_div_contract_sqrt_f64:5044; SI-SDAG: ; %bb.0:5045; SI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)5046; SI-SDAG-NEXT: s_mov_b32 s4, 05047; SI-SDAG-NEXT: s_brev_b32 s5, 85048; SI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[2:3]5049; SI-SDAG-NEXT: v_mov_b32_e32 v4, 0x1005050; SI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc5051; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v45052; SI-SDAG-NEXT: v_rsq_f64_e32 v[4:5], v[2:3]5053; SI-SDAG-NEXT: v_mul_f64 v[6:7], v[2:3], v[4:5]5054; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[4:5], 0.55055; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[4:5], v[6:7], 0.55056; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5057; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]5058; SI-SDAG-NEXT: v_fma_f64 v[10:11], -v[6:7], v[6:7], v[2:3]5059; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[10:11], v[4:5], v[6:7]5060; SI-SDAG-NEXT: v_mov_b32_e32 v10, 0xffffff805061; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[6:7], v[6:7], v[2:3]5062; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[8:9], v[4:5], v[6:7]5063; SI-SDAG-NEXT: v_cndmask_b32_e32 v6, 0, v10, vcc5064; SI-SDAG-NEXT: v_ldexp_f64 v[4:5], v[4:5], v65065; SI-SDAG-NEXT: v_mov_b32_e32 v6, 0x2605066; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[2:3], v65067; SI-SDAG-NEXT: v_cndmask_b32_e32 v3, v5, v3, vcc5068; SI-SDAG-NEXT: v_cndmask_b32_e32 v2, v4, v2, vcc5069; SI-SDAG-NEXT: v_div_scale_f64 v[4:5], s[4:5], v[2:3], v[2:3], v[0:1]5070; SI-SDAG-NEXT: v_rcp_f64_e32 v[6:7], v[4:5]5071; SI-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, v3, v55072; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[4:5], v[6:7], 1.05073; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5074; SI-SDAG-NEXT: v_div_scale_f64 v[8:9], s[4:5], v[0:1], v[2:3], v[0:1]5075; SI-SDAG-NEXT: v_fma_f64 v[10:11], -v[4:5], v[6:7], 1.05076; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[10:11], v[6:7]5077; SI-SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], v1, v95078; SI-SDAG-NEXT: v_mul_f64 v[10:11], v[8:9], v[6:7]5079; SI-SDAG-NEXT: s_xor_b64 vcc, s[4:5], vcc5080; SI-SDAG-NEXT: v_fma_f64 v[4:5], -v[4:5], v[10:11], v[8:9]5081; SI-SDAG-NEXT: v_div_fmas_f64 v[4:5], v[4:5], v[6:7], v[10:11]5082; SI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[4:5], v[2:3], v[0:1]5083; SI-SDAG-NEXT: s_setpc_b64 s[30:31]5084;5085; SI-GISEL-LABEL: v_div_contract_sqrt_f64:5086; SI-GISEL: ; %bb.0:5087; SI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)5088; SI-GISEL-NEXT: v_mov_b32_e32 v4, 05089; SI-GISEL-NEXT: v_bfrev_b32_e32 v5, 85090; SI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[2:3], v[4:5]5091; SI-GISEL-NEXT: v_mov_b32_e32 v10, 0xffffff805092; SI-GISEL-NEXT: v_cndmask_b32_e64 v4, 0, 1, vcc5093; SI-GISEL-NEXT: v_lshlrev_b32_e32 v4, 8, v45094; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v45095; SI-GISEL-NEXT: v_mov_b32_e32 v11, 0x2605096; SI-GISEL-NEXT: v_rsq_f64_e32 v[4:5], v[2:3]5097; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[4:5], 0.55098; SI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], v[4:5]5099; SI-GISEL-NEXT: v_fma_f64 v[8:9], -v[6:7], v[4:5], 0.55100; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]5101; SI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5102; SI-GISEL-NEXT: v_fma_f64 v[8:9], -v[4:5], v[4:5], v[2:3]5103; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[8:9], v[6:7], v[4:5]5104; SI-GISEL-NEXT: v_fma_f64 v[8:9], -v[4:5], v[4:5], v[2:3]5105; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[8:9], v[6:7], v[4:5]5106; SI-GISEL-NEXT: v_cndmask_b32_e32 v6, 0, v10, vcc5107; SI-GISEL-NEXT: v_ldexp_f64 v[4:5], v[4:5], v65108; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[2:3], v115109; SI-GISEL-NEXT: v_cndmask_b32_e32 v2, v4, v2, vcc5110; SI-GISEL-NEXT: v_cndmask_b32_e32 v3, v5, v3, vcc5111; SI-GISEL-NEXT: v_div_scale_f64 v[4:5], s[4:5], v[2:3], v[2:3], v[0:1]5112; SI-GISEL-NEXT: v_div_scale_f64 v[10:11], s[4:5], v[0:1], v[2:3], v[0:1]5113; SI-GISEL-NEXT: v_rcp_f64_e32 v[6:7], v[4:5]5114; SI-GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], v3, v55115; SI-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v1, v115116; SI-GISEL-NEXT: s_xor_b64 vcc, vcc, s[4:5]5117; SI-GISEL-NEXT: v_fma_f64 v[8:9], -v[4:5], v[6:7], 1.05118; SI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5119; SI-GISEL-NEXT: v_fma_f64 v[8:9], -v[4:5], v[6:7], 1.05120; SI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5121; SI-GISEL-NEXT: v_mul_f64 v[8:9], v[10:11], v[6:7]5122; SI-GISEL-NEXT: v_fma_f64 v[4:5], -v[4:5], v[8:9], v[10:11]5123; SI-GISEL-NEXT: v_div_fmas_f64 v[4:5], v[4:5], v[6:7], v[8:9]5124; SI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[4:5], v[2:3], v[0:1]5125; SI-GISEL-NEXT: s_setpc_b64 s[30:31]5126;5127; VI-SDAG-LABEL: v_div_contract_sqrt_f64:5128; VI-SDAG: ; %bb.0:5129; VI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)5130; VI-SDAG-NEXT: s_mov_b32 s4, 05131; VI-SDAG-NEXT: s_brev_b32 s5, 85132; VI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[2:3]5133; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0x1005134; VI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc5135; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v45136; VI-SDAG-NEXT: v_rsq_f64_e32 v[4:5], v[2:3]5137; VI-SDAG-NEXT: v_mul_f64 v[6:7], v[2:3], v[4:5]5138; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[4:5], 0.55139; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[4:5], v[6:7], 0.55140; VI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5141; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]5142; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[6:7], v[6:7], v[2:3]5143; VI-SDAG-NEXT: v_fma_f64 v[6:7], v[8:9], v[4:5], v[6:7]5144; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[6:7], v[6:7], v[2:3]5145; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[8:9], v[4:5], v[6:7]5146; VI-SDAG-NEXT: v_mov_b32_e32 v6, 0xffffff805147; VI-SDAG-NEXT: v_mov_b32_e32 v7, 0x2605148; VI-SDAG-NEXT: v_cndmask_b32_e32 v6, 0, v6, vcc5149; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[2:3], v75150; VI-SDAG-NEXT: v_ldexp_f64 v[4:5], v[4:5], v65151; VI-SDAG-NEXT: v_cndmask_b32_e32 v3, v5, v3, vcc5152; VI-SDAG-NEXT: v_cndmask_b32_e32 v2, v4, v2, vcc5153; VI-SDAG-NEXT: v_div_scale_f64 v[4:5], s[4:5], v[2:3], v[2:3], v[0:1]5154; VI-SDAG-NEXT: v_rcp_f64_e32 v[6:7], v[4:5]5155; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[4:5], v[6:7], 1.05156; VI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5157; VI-SDAG-NEXT: v_div_scale_f64 v[8:9], vcc, v[0:1], v[2:3], v[0:1]5158; VI-SDAG-NEXT: v_fma_f64 v[10:11], -v[4:5], v[6:7], 1.05159; VI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[10:11], v[6:7]5160; VI-SDAG-NEXT: v_mul_f64 v[10:11], v[8:9], v[6:7]5161; VI-SDAG-NEXT: v_fma_f64 v[4:5], -v[4:5], v[10:11], v[8:9]5162; VI-SDAG-NEXT: v_div_fmas_f64 v[4:5], v[4:5], v[6:7], v[10:11]5163; VI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[4:5], v[2:3], v[0:1]5164; VI-SDAG-NEXT: s_setpc_b64 s[30:31]5165;5166; VI-GISEL-LABEL: v_div_contract_sqrt_f64:5167; VI-GISEL: ; %bb.0:5168; VI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)5169; VI-GISEL-NEXT: v_mov_b32_e32 v4, 05170; VI-GISEL-NEXT: v_bfrev_b32_e32 v5, 85171; VI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[2:3], v[4:5]5172; VI-GISEL-NEXT: v_cndmask_b32_e64 v4, 0, 1, vcc5173; VI-GISEL-NEXT: v_lshlrev_b32_e32 v4, 8, v45174; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v45175; VI-GISEL-NEXT: v_rsq_f64_e32 v[4:5], v[2:3]5176; VI-GISEL-NEXT: v_mul_f64 v[6:7], v[4:5], 0.55177; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], v[4:5]5178; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[6:7], v[4:5], 0.55179; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]5180; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5181; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[4:5], v[4:5], v[2:3]5182; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[8:9], v[6:7], v[4:5]5183; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[4:5], v[4:5], v[2:3]5184; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[8:9], v[6:7], v[4:5]5185; VI-GISEL-NEXT: v_mov_b32_e32 v6, 0xffffff805186; VI-GISEL-NEXT: v_mov_b32_e32 v7, 0x2605187; VI-GISEL-NEXT: v_cndmask_b32_e32 v6, 0, v6, vcc5188; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[2:3], v75189; VI-GISEL-NEXT: v_ldexp_f64 v[4:5], v[4:5], v65190; VI-GISEL-NEXT: v_cndmask_b32_e32 v2, v4, v2, vcc5191; VI-GISEL-NEXT: v_cndmask_b32_e32 v3, v5, v3, vcc5192; VI-GISEL-NEXT: v_div_scale_f64 v[4:5], s[4:5], v[2:3], v[2:3], v[0:1]5193; VI-GISEL-NEXT: v_rcp_f64_e32 v[6:7], v[4:5]5194; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[4:5], v[6:7], 1.05195; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5196; VI-GISEL-NEXT: v_div_scale_f64 v[8:9], vcc, v[0:1], v[2:3], v[0:1]5197; VI-GISEL-NEXT: v_fma_f64 v[10:11], -v[4:5], v[6:7], 1.05198; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[10:11], v[6:7]5199; VI-GISEL-NEXT: v_mul_f64 v[10:11], v[8:9], v[6:7]5200; VI-GISEL-NEXT: v_fma_f64 v[4:5], -v[4:5], v[10:11], v[8:9]5201; VI-GISEL-NEXT: v_div_fmas_f64 v[4:5], v[4:5], v[6:7], v[10:11]5202; VI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[4:5], v[2:3], v[0:1]5203; VI-GISEL-NEXT: s_setpc_b64 s[30:31]5204 %sqrt = call contract double @llvm.sqrt.f64(double %y)5205 %rsq = fdiv contract double %x, %sqrt5206 ret double %rsq5207}5208 5209define double @v_div_arcp_sqrt_f64(double %x, double %y) {5210; SI-SDAG-LABEL: v_div_arcp_sqrt_f64:5211; SI-SDAG: ; %bb.0:5212; SI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)5213; SI-SDAG-NEXT: s_mov_b32 s4, 05214; SI-SDAG-NEXT: s_brev_b32 s5, 85215; SI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[2:3]5216; SI-SDAG-NEXT: v_mov_b32_e32 v4, 0x1005217; SI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc5218; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v45219; SI-SDAG-NEXT: v_rsq_f64_e32 v[4:5], v[2:3]5220; SI-SDAG-NEXT: v_mul_f64 v[6:7], v[2:3], v[4:5]5221; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[4:5], 0.55222; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[4:5], v[6:7], 0.55223; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5224; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]5225; SI-SDAG-NEXT: v_fma_f64 v[10:11], -v[6:7], v[6:7], v[2:3]5226; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[10:11], v[4:5], v[6:7]5227; SI-SDAG-NEXT: v_mov_b32_e32 v10, 0xffffff805228; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[6:7], v[6:7], v[2:3]5229; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[8:9], v[4:5], v[6:7]5230; SI-SDAG-NEXT: v_cndmask_b32_e32 v6, 0, v10, vcc5231; SI-SDAG-NEXT: v_ldexp_f64 v[4:5], v[4:5], v65232; SI-SDAG-NEXT: v_mov_b32_e32 v6, 0x2605233; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[2:3], v65234; SI-SDAG-NEXT: v_cndmask_b32_e32 v3, v5, v3, vcc5235; SI-SDAG-NEXT: v_cndmask_b32_e32 v2, v4, v2, vcc5236; SI-SDAG-NEXT: v_div_scale_f64 v[4:5], s[4:5], v[2:3], v[2:3], v[0:1]5237; SI-SDAG-NEXT: v_rcp_f64_e32 v[6:7], v[4:5]5238; SI-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, v3, v55239; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[4:5], v[6:7], 1.05240; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5241; SI-SDAG-NEXT: v_div_scale_f64 v[8:9], s[4:5], v[0:1], v[2:3], v[0:1]5242; SI-SDAG-NEXT: v_fma_f64 v[10:11], -v[4:5], v[6:7], 1.05243; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[10:11], v[6:7]5244; SI-SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], v1, v95245; SI-SDAG-NEXT: v_mul_f64 v[10:11], v[8:9], v[6:7]5246; SI-SDAG-NEXT: s_xor_b64 vcc, s[4:5], vcc5247; SI-SDAG-NEXT: v_fma_f64 v[4:5], -v[4:5], v[10:11], v[8:9]5248; SI-SDAG-NEXT: v_div_fmas_f64 v[4:5], v[4:5], v[6:7], v[10:11]5249; SI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[4:5], v[2:3], v[0:1]5250; SI-SDAG-NEXT: s_setpc_b64 s[30:31]5251;5252; SI-GISEL-LABEL: v_div_arcp_sqrt_f64:5253; SI-GISEL: ; %bb.0:5254; SI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)5255; SI-GISEL-NEXT: v_mov_b32_e32 v4, 05256; SI-GISEL-NEXT: v_bfrev_b32_e32 v5, 85257; SI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[2:3], v[4:5]5258; SI-GISEL-NEXT: v_mov_b32_e32 v10, 0xffffff805259; SI-GISEL-NEXT: v_cndmask_b32_e64 v4, 0, 1, vcc5260; SI-GISEL-NEXT: v_lshlrev_b32_e32 v4, 8, v45261; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v45262; SI-GISEL-NEXT: v_mov_b32_e32 v11, 0x2605263; SI-GISEL-NEXT: v_rsq_f64_e32 v[4:5], v[2:3]5264; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[4:5], 0.55265; SI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], v[4:5]5266; SI-GISEL-NEXT: v_fma_f64 v[8:9], -v[6:7], v[4:5], 0.55267; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]5268; SI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5269; SI-GISEL-NEXT: v_fma_f64 v[8:9], -v[4:5], v[4:5], v[2:3]5270; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[8:9], v[6:7], v[4:5]5271; SI-GISEL-NEXT: v_fma_f64 v[8:9], -v[4:5], v[4:5], v[2:3]5272; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[8:9], v[6:7], v[4:5]5273; SI-GISEL-NEXT: v_cndmask_b32_e32 v6, 0, v10, vcc5274; SI-GISEL-NEXT: v_ldexp_f64 v[4:5], v[4:5], v65275; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[2:3], v115276; SI-GISEL-NEXT: v_cndmask_b32_e32 v2, v4, v2, vcc5277; SI-GISEL-NEXT: v_cndmask_b32_e32 v3, v5, v3, vcc5278; SI-GISEL-NEXT: v_div_scale_f64 v[4:5], s[4:5], v[2:3], v[2:3], v[0:1]5279; SI-GISEL-NEXT: v_div_scale_f64 v[10:11], s[4:5], v[0:1], v[2:3], v[0:1]5280; SI-GISEL-NEXT: v_rcp_f64_e32 v[6:7], v[4:5]5281; SI-GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], v3, v55282; SI-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v1, v115283; SI-GISEL-NEXT: s_xor_b64 vcc, vcc, s[4:5]5284; SI-GISEL-NEXT: v_fma_f64 v[8:9], -v[4:5], v[6:7], 1.05285; SI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5286; SI-GISEL-NEXT: v_fma_f64 v[8:9], -v[4:5], v[6:7], 1.05287; SI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5288; SI-GISEL-NEXT: v_mul_f64 v[8:9], v[10:11], v[6:7]5289; SI-GISEL-NEXT: v_fma_f64 v[4:5], -v[4:5], v[8:9], v[10:11]5290; SI-GISEL-NEXT: v_div_fmas_f64 v[4:5], v[4:5], v[6:7], v[8:9]5291; SI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[4:5], v[2:3], v[0:1]5292; SI-GISEL-NEXT: s_setpc_b64 s[30:31]5293;5294; VI-SDAG-LABEL: v_div_arcp_sqrt_f64:5295; VI-SDAG: ; %bb.0:5296; VI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)5297; VI-SDAG-NEXT: s_mov_b32 s4, 05298; VI-SDAG-NEXT: s_brev_b32 s5, 85299; VI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[2:3]5300; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0x1005301; VI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc5302; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v45303; VI-SDAG-NEXT: v_rsq_f64_e32 v[4:5], v[2:3]5304; VI-SDAG-NEXT: v_mul_f64 v[6:7], v[2:3], v[4:5]5305; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[4:5], 0.55306; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[4:5], v[6:7], 0.55307; VI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5308; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]5309; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[6:7], v[6:7], v[2:3]5310; VI-SDAG-NEXT: v_fma_f64 v[6:7], v[8:9], v[4:5], v[6:7]5311; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[6:7], v[6:7], v[2:3]5312; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[8:9], v[4:5], v[6:7]5313; VI-SDAG-NEXT: v_mov_b32_e32 v6, 0xffffff805314; VI-SDAG-NEXT: v_mov_b32_e32 v7, 0x2605315; VI-SDAG-NEXT: v_cndmask_b32_e32 v6, 0, v6, vcc5316; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[2:3], v75317; VI-SDAG-NEXT: v_ldexp_f64 v[4:5], v[4:5], v65318; VI-SDAG-NEXT: v_cndmask_b32_e32 v3, v5, v3, vcc5319; VI-SDAG-NEXT: v_cndmask_b32_e32 v2, v4, v2, vcc5320; VI-SDAG-NEXT: v_div_scale_f64 v[4:5], s[4:5], v[2:3], v[2:3], v[0:1]5321; VI-SDAG-NEXT: v_rcp_f64_e32 v[6:7], v[4:5]5322; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[4:5], v[6:7], 1.05323; VI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5324; VI-SDAG-NEXT: v_div_scale_f64 v[8:9], vcc, v[0:1], v[2:3], v[0:1]5325; VI-SDAG-NEXT: v_fma_f64 v[10:11], -v[4:5], v[6:7], 1.05326; VI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[10:11], v[6:7]5327; VI-SDAG-NEXT: v_mul_f64 v[10:11], v[8:9], v[6:7]5328; VI-SDAG-NEXT: v_fma_f64 v[4:5], -v[4:5], v[10:11], v[8:9]5329; VI-SDAG-NEXT: v_div_fmas_f64 v[4:5], v[4:5], v[6:7], v[10:11]5330; VI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[4:5], v[2:3], v[0:1]5331; VI-SDAG-NEXT: s_setpc_b64 s[30:31]5332;5333; VI-GISEL-LABEL: v_div_arcp_sqrt_f64:5334; VI-GISEL: ; %bb.0:5335; VI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)5336; VI-GISEL-NEXT: v_mov_b32_e32 v4, 05337; VI-GISEL-NEXT: v_bfrev_b32_e32 v5, 85338; VI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[2:3], v[4:5]5339; VI-GISEL-NEXT: v_cndmask_b32_e64 v4, 0, 1, vcc5340; VI-GISEL-NEXT: v_lshlrev_b32_e32 v4, 8, v45341; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v45342; VI-GISEL-NEXT: v_rsq_f64_e32 v[4:5], v[2:3]5343; VI-GISEL-NEXT: v_mul_f64 v[6:7], v[4:5], 0.55344; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], v[4:5]5345; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[6:7], v[4:5], 0.55346; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]5347; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5348; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[4:5], v[4:5], v[2:3]5349; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[8:9], v[6:7], v[4:5]5350; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[4:5], v[4:5], v[2:3]5351; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[8:9], v[6:7], v[4:5]5352; VI-GISEL-NEXT: v_mov_b32_e32 v6, 0xffffff805353; VI-GISEL-NEXT: v_mov_b32_e32 v7, 0x2605354; VI-GISEL-NEXT: v_cndmask_b32_e32 v6, 0, v6, vcc5355; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[2:3], v75356; VI-GISEL-NEXT: v_ldexp_f64 v[4:5], v[4:5], v65357; VI-GISEL-NEXT: v_cndmask_b32_e32 v2, v4, v2, vcc5358; VI-GISEL-NEXT: v_cndmask_b32_e32 v3, v5, v3, vcc5359; VI-GISEL-NEXT: v_div_scale_f64 v[4:5], s[4:5], v[2:3], v[2:3], v[0:1]5360; VI-GISEL-NEXT: v_rcp_f64_e32 v[6:7], v[4:5]5361; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[4:5], v[6:7], 1.05362; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5363; VI-GISEL-NEXT: v_div_scale_f64 v[8:9], vcc, v[0:1], v[2:3], v[0:1]5364; VI-GISEL-NEXT: v_fma_f64 v[10:11], -v[4:5], v[6:7], 1.05365; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[10:11], v[6:7]5366; VI-GISEL-NEXT: v_mul_f64 v[10:11], v[8:9], v[6:7]5367; VI-GISEL-NEXT: v_fma_f64 v[4:5], -v[4:5], v[10:11], v[8:9]5368; VI-GISEL-NEXT: v_div_fmas_f64 v[4:5], v[4:5], v[6:7], v[10:11]5369; VI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[4:5], v[2:3], v[0:1]5370; VI-GISEL-NEXT: s_setpc_b64 s[30:31]5371 %sqrt = call double @llvm.sqrt.f64(double %y)5372 %rsq = fdiv arcp double %x, %sqrt5373 ret double %rsq5374}5375 5376define double @v_div_contract_arcp_sqrt_f64(double %x, double %y) {5377; SI-SDAG-LABEL: v_div_contract_arcp_sqrt_f64:5378; SI-SDAG: ; %bb.0:5379; SI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)5380; SI-SDAG-NEXT: s_mov_b32 s4, 05381; SI-SDAG-NEXT: s_brev_b32 s5, 85382; SI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[2:3]5383; SI-SDAG-NEXT: v_mov_b32_e32 v4, 0x1005384; SI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc5385; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v45386; SI-SDAG-NEXT: v_rsq_f64_e32 v[4:5], v[2:3]5387; SI-SDAG-NEXT: v_mul_f64 v[6:7], v[2:3], v[4:5]5388; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[4:5], 0.55389; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[4:5], v[6:7], 0.55390; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5391; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]5392; SI-SDAG-NEXT: v_fma_f64 v[10:11], -v[6:7], v[6:7], v[2:3]5393; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[10:11], v[4:5], v[6:7]5394; SI-SDAG-NEXT: v_mov_b32_e32 v10, 0xffffff805395; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[6:7], v[6:7], v[2:3]5396; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[8:9], v[4:5], v[6:7]5397; SI-SDAG-NEXT: v_cndmask_b32_e32 v6, 0, v10, vcc5398; SI-SDAG-NEXT: v_ldexp_f64 v[4:5], v[4:5], v65399; SI-SDAG-NEXT: v_mov_b32_e32 v6, 0x2605400; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[2:3], v65401; SI-SDAG-NEXT: v_cndmask_b32_e32 v3, v5, v3, vcc5402; SI-SDAG-NEXT: v_cndmask_b32_e32 v2, v4, v2, vcc5403; SI-SDAG-NEXT: v_div_scale_f64 v[4:5], s[4:5], v[2:3], v[2:3], v[0:1]5404; SI-SDAG-NEXT: v_rcp_f64_e32 v[6:7], v[4:5]5405; SI-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, v3, v55406; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[4:5], v[6:7], 1.05407; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5408; SI-SDAG-NEXT: v_div_scale_f64 v[8:9], s[4:5], v[0:1], v[2:3], v[0:1]5409; SI-SDAG-NEXT: v_fma_f64 v[10:11], -v[4:5], v[6:7], 1.05410; SI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[10:11], v[6:7]5411; SI-SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], v1, v95412; SI-SDAG-NEXT: v_mul_f64 v[10:11], v[8:9], v[6:7]5413; SI-SDAG-NEXT: s_xor_b64 vcc, s[4:5], vcc5414; SI-SDAG-NEXT: v_fma_f64 v[4:5], -v[4:5], v[10:11], v[8:9]5415; SI-SDAG-NEXT: v_div_fmas_f64 v[4:5], v[4:5], v[6:7], v[10:11]5416; SI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[4:5], v[2:3], v[0:1]5417; SI-SDAG-NEXT: s_setpc_b64 s[30:31]5418;5419; SI-GISEL-LABEL: v_div_contract_arcp_sqrt_f64:5420; SI-GISEL: ; %bb.0:5421; SI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)5422; SI-GISEL-NEXT: v_mov_b32_e32 v4, 05423; SI-GISEL-NEXT: v_bfrev_b32_e32 v5, 85424; SI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[2:3], v[4:5]5425; SI-GISEL-NEXT: v_mov_b32_e32 v10, 0xffffff805426; SI-GISEL-NEXT: v_cndmask_b32_e64 v4, 0, 1, vcc5427; SI-GISEL-NEXT: v_lshlrev_b32_e32 v4, 8, v45428; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v45429; SI-GISEL-NEXT: v_mov_b32_e32 v11, 0x2605430; SI-GISEL-NEXT: v_rsq_f64_e32 v[4:5], v[2:3]5431; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[4:5], 0.55432; SI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], v[4:5]5433; SI-GISEL-NEXT: v_fma_f64 v[8:9], -v[6:7], v[4:5], 0.55434; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]5435; SI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5436; SI-GISEL-NEXT: v_fma_f64 v[8:9], -v[4:5], v[4:5], v[2:3]5437; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[8:9], v[6:7], v[4:5]5438; SI-GISEL-NEXT: v_fma_f64 v[8:9], -v[4:5], v[4:5], v[2:3]5439; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[8:9], v[6:7], v[4:5]5440; SI-GISEL-NEXT: v_cndmask_b32_e32 v6, 0, v10, vcc5441; SI-GISEL-NEXT: v_ldexp_f64 v[4:5], v[4:5], v65442; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[2:3], v115443; SI-GISEL-NEXT: v_cndmask_b32_e32 v2, v4, v2, vcc5444; SI-GISEL-NEXT: v_cndmask_b32_e32 v3, v5, v3, vcc5445; SI-GISEL-NEXT: v_div_scale_f64 v[4:5], s[4:5], v[2:3], v[2:3], v[0:1]5446; SI-GISEL-NEXT: v_div_scale_f64 v[10:11], s[4:5], v[0:1], v[2:3], v[0:1]5447; SI-GISEL-NEXT: v_rcp_f64_e32 v[6:7], v[4:5]5448; SI-GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], v3, v55449; SI-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v1, v115450; SI-GISEL-NEXT: s_xor_b64 vcc, vcc, s[4:5]5451; SI-GISEL-NEXT: v_fma_f64 v[8:9], -v[4:5], v[6:7], 1.05452; SI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5453; SI-GISEL-NEXT: v_fma_f64 v[8:9], -v[4:5], v[6:7], 1.05454; SI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5455; SI-GISEL-NEXT: v_mul_f64 v[8:9], v[10:11], v[6:7]5456; SI-GISEL-NEXT: v_fma_f64 v[4:5], -v[4:5], v[8:9], v[10:11]5457; SI-GISEL-NEXT: v_div_fmas_f64 v[4:5], v[4:5], v[6:7], v[8:9]5458; SI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[4:5], v[2:3], v[0:1]5459; SI-GISEL-NEXT: s_setpc_b64 s[30:31]5460;5461; VI-SDAG-LABEL: v_div_contract_arcp_sqrt_f64:5462; VI-SDAG: ; %bb.0:5463; VI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)5464; VI-SDAG-NEXT: s_mov_b32 s4, 05465; VI-SDAG-NEXT: s_brev_b32 s5, 85466; VI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[2:3]5467; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0x1005468; VI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc5469; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v45470; VI-SDAG-NEXT: v_rsq_f64_e32 v[4:5], v[2:3]5471; VI-SDAG-NEXT: v_mul_f64 v[6:7], v[2:3], v[4:5]5472; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[4:5], 0.55473; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[4:5], v[6:7], 0.55474; VI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5475; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]5476; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[6:7], v[6:7], v[2:3]5477; VI-SDAG-NEXT: v_fma_f64 v[6:7], v[8:9], v[4:5], v[6:7]5478; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[6:7], v[6:7], v[2:3]5479; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[8:9], v[4:5], v[6:7]5480; VI-SDAG-NEXT: v_mov_b32_e32 v6, 0xffffff805481; VI-SDAG-NEXT: v_mov_b32_e32 v7, 0x2605482; VI-SDAG-NEXT: v_cndmask_b32_e32 v6, 0, v6, vcc5483; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[2:3], v75484; VI-SDAG-NEXT: v_ldexp_f64 v[4:5], v[4:5], v65485; VI-SDAG-NEXT: v_cndmask_b32_e32 v3, v5, v3, vcc5486; VI-SDAG-NEXT: v_cndmask_b32_e32 v2, v4, v2, vcc5487; VI-SDAG-NEXT: v_div_scale_f64 v[4:5], s[4:5], v[2:3], v[2:3], v[0:1]5488; VI-SDAG-NEXT: v_rcp_f64_e32 v[6:7], v[4:5]5489; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[4:5], v[6:7], 1.05490; VI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5491; VI-SDAG-NEXT: v_div_scale_f64 v[8:9], vcc, v[0:1], v[2:3], v[0:1]5492; VI-SDAG-NEXT: v_fma_f64 v[10:11], -v[4:5], v[6:7], 1.05493; VI-SDAG-NEXT: v_fma_f64 v[6:7], v[6:7], v[10:11], v[6:7]5494; VI-SDAG-NEXT: v_mul_f64 v[10:11], v[8:9], v[6:7]5495; VI-SDAG-NEXT: v_fma_f64 v[4:5], -v[4:5], v[10:11], v[8:9]5496; VI-SDAG-NEXT: v_div_fmas_f64 v[4:5], v[4:5], v[6:7], v[10:11]5497; VI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[4:5], v[2:3], v[0:1]5498; VI-SDAG-NEXT: s_setpc_b64 s[30:31]5499;5500; VI-GISEL-LABEL: v_div_contract_arcp_sqrt_f64:5501; VI-GISEL: ; %bb.0:5502; VI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)5503; VI-GISEL-NEXT: v_mov_b32_e32 v4, 05504; VI-GISEL-NEXT: v_bfrev_b32_e32 v5, 85505; VI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[2:3], v[4:5]5506; VI-GISEL-NEXT: v_cndmask_b32_e64 v4, 0, 1, vcc5507; VI-GISEL-NEXT: v_lshlrev_b32_e32 v4, 8, v45508; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v45509; VI-GISEL-NEXT: v_rsq_f64_e32 v[4:5], v[2:3]5510; VI-GISEL-NEXT: v_mul_f64 v[6:7], v[4:5], 0.55511; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], v[4:5]5512; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[6:7], v[4:5], 0.55513; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]5514; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5515; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[4:5], v[4:5], v[2:3]5516; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[8:9], v[6:7], v[4:5]5517; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[4:5], v[4:5], v[2:3]5518; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[8:9], v[6:7], v[4:5]5519; VI-GISEL-NEXT: v_mov_b32_e32 v6, 0xffffff805520; VI-GISEL-NEXT: v_mov_b32_e32 v7, 0x2605521; VI-GISEL-NEXT: v_cndmask_b32_e32 v6, 0, v6, vcc5522; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[2:3], v75523; VI-GISEL-NEXT: v_ldexp_f64 v[4:5], v[4:5], v65524; VI-GISEL-NEXT: v_cndmask_b32_e32 v2, v4, v2, vcc5525; VI-GISEL-NEXT: v_cndmask_b32_e32 v3, v5, v3, vcc5526; VI-GISEL-NEXT: v_div_scale_f64 v[4:5], s[4:5], v[2:3], v[2:3], v[0:1]5527; VI-GISEL-NEXT: v_rcp_f64_e32 v[6:7], v[4:5]5528; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[4:5], v[6:7], 1.05529; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5530; VI-GISEL-NEXT: v_div_scale_f64 v[8:9], vcc, v[0:1], v[2:3], v[0:1]5531; VI-GISEL-NEXT: v_fma_f64 v[10:11], -v[4:5], v[6:7], 1.05532; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[10:11], v[6:7]5533; VI-GISEL-NEXT: v_mul_f64 v[10:11], v[8:9], v[6:7]5534; VI-GISEL-NEXT: v_fma_f64 v[4:5], -v[4:5], v[10:11], v[8:9]5535; VI-GISEL-NEXT: v_div_fmas_f64 v[4:5], v[4:5], v[6:7], v[10:11]5536; VI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[4:5], v[2:3], v[0:1]5537; VI-GISEL-NEXT: s_setpc_b64 s[30:31]5538 %sqrt = call contract double @llvm.sqrt.f64(double %y)5539 %rsq = fdiv contract arcp double %x, %sqrt5540 ret double %rsq5541}5542 5543define double @v_div_const_contract_sqrt_f64(double %x) {5544; SI-SDAG-LABEL: v_div_const_contract_sqrt_f64:5545; SI-SDAG: ; %bb.0:5546; SI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)5547; SI-SDAG-NEXT: s_mov_b32 s4, 05548; SI-SDAG-NEXT: s_brev_b32 s5, 85549; SI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]5550; SI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1005551; SI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc5552; SI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v25553; SI-SDAG-NEXT: v_mov_b32_e32 v8, 0xffffff805554; SI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]5555; SI-SDAG-NEXT: v_mov_b32_e32 v9, 0x2605556; SI-SDAG-NEXT: s_mov_b32 s6, 05557; SI-SDAG-NEXT: s_mov_b32 s7, 0x407000005558; SI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]5559; SI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.55560; SI-SDAG-NEXT: s_mov_b32 s8, 0x407000005561; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.55562; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]5563; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]5564; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]5565; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]5566; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]5567; SI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]5568; SI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v8, vcc5569; SI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v45570; SI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v95571; SI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc5572; SI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc5573; SI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], s[6:7]5574; SI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]5575; SI-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, v1, v35576; SI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.05577; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]5578; SI-SDAG-NEXT: v_div_scale_f64 v[6:7], s[4:5], s[6:7], v[0:1], s[6:7]5579; SI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.05580; SI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]5581; SI-SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], s8, v75582; SI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]5583; SI-SDAG-NEXT: s_xor_b64 vcc, s[4:5], vcc5584; SI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]5585; SI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]5586; SI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], s[6:7]5587; SI-SDAG-NEXT: s_setpc_b64 s[30:31]5588;5589; SI-GISEL-LABEL: v_div_const_contract_sqrt_f64:5590; SI-GISEL: ; %bb.0:5591; SI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)5592; SI-GISEL-NEXT: v_mov_b32_e32 v2, 05593; SI-GISEL-NEXT: v_bfrev_b32_e32 v3, 85594; SI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]5595; SI-GISEL-NEXT: v_mov_b32_e32 v10, 0xffffff805596; SI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc5597; SI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v25598; SI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v25599; SI-GISEL-NEXT: v_mov_b32_e32 v11, 0x2605600; SI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]5601; SI-GISEL-NEXT: v_mov_b32_e32 v8, 05602; SI-GISEL-NEXT: v_mov_b32_e32 v9, 0x407000005603; SI-GISEL-NEXT: v_mov_b32_e32 v12, 0x407000005604; SI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.55605; SI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]5606; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.55607; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]5608; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]5609; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]5610; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]5611; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]5612; SI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]5613; SI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v10, vcc5614; SI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v45615; SI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v115616; SI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc5617; SI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc5618; SI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], v[8:9]5619; SI-GISEL-NEXT: v_div_scale_f64 v[10:11], s[4:5], v[8:9], v[0:1], v[8:9]5620; SI-GISEL-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]5621; SI-GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], v1, v35622; SI-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v11, v125623; SI-GISEL-NEXT: s_xor_b64 vcc, vcc, s[4:5]5624; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.05625; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]5626; SI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.05627; SI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]5628; SI-GISEL-NEXT: v_mul_f64 v[6:7], v[10:11], v[4:5]5629; SI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[6:7], v[10:11]5630; SI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[6:7]5631; SI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], v[8:9]5632; SI-GISEL-NEXT: s_setpc_b64 s[30:31]5633;5634; VI-SDAG-LABEL: v_div_const_contract_sqrt_f64:5635; VI-SDAG: ; %bb.0:5636; VI-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)5637; VI-SDAG-NEXT: s_mov_b32 s4, 05638; VI-SDAG-NEXT: s_brev_b32 s5, 85639; VI-SDAG-NEXT: v_cmp_gt_f64_e32 vcc, s[4:5], v[0:1]5640; VI-SDAG-NEXT: v_mov_b32_e32 v2, 0x1005641; VI-SDAG-NEXT: s_mov_b32 s4, 05642; VI-SDAG-NEXT: s_mov_b32 s5, 0x407000005643; VI-SDAG-NEXT: v_cndmask_b32_e32 v2, 0, v2, vcc5644; VI-SDAG-NEXT: v_ldexp_f64 v[0:1], v[0:1], v25645; VI-SDAG-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]5646; VI-SDAG-NEXT: v_mul_f64 v[4:5], v[0:1], v[2:3]5647; VI-SDAG-NEXT: v_mul_f64 v[2:3], v[2:3], 0.55648; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 0.55649; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]5650; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]5651; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]5652; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[6:7], v[2:3], v[4:5]5653; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[4:5], v[4:5], v[0:1]5654; VI-SDAG-NEXT: v_fma_f64 v[2:3], v[6:7], v[2:3], v[4:5]5655; VI-SDAG-NEXT: v_mov_b32_e32 v4, 0xffffff805656; VI-SDAG-NEXT: v_mov_b32_e32 v5, 0x2605657; VI-SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc5658; VI-SDAG-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v55659; VI-SDAG-NEXT: v_ldexp_f64 v[2:3], v[2:3], v45660; VI-SDAG-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc5661; VI-SDAG-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc5662; VI-SDAG-NEXT: v_div_scale_f64 v[2:3], s[6:7], v[0:1], v[0:1], s[4:5]5663; VI-SDAG-NEXT: v_rcp_f64_e32 v[4:5], v[2:3]5664; VI-SDAG-NEXT: v_fma_f64 v[6:7], -v[2:3], v[4:5], 1.05665; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]5666; VI-SDAG-NEXT: v_div_scale_f64 v[6:7], vcc, s[4:5], v[0:1], s[4:5]5667; VI-SDAG-NEXT: v_fma_f64 v[8:9], -v[2:3], v[4:5], 1.05668; VI-SDAG-NEXT: v_fma_f64 v[4:5], v[4:5], v[8:9], v[4:5]5669; VI-SDAG-NEXT: v_mul_f64 v[8:9], v[6:7], v[4:5]5670; VI-SDAG-NEXT: v_fma_f64 v[2:3], -v[2:3], v[8:9], v[6:7]5671; VI-SDAG-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[4:5], v[8:9]5672; VI-SDAG-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], s[4:5]5673; VI-SDAG-NEXT: s_setpc_b64 s[30:31]5674;5675; VI-GISEL-LABEL: v_div_const_contract_sqrt_f64:5676; VI-GISEL: ; %bb.0:5677; VI-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)5678; VI-GISEL-NEXT: v_mov_b32_e32 v2, 05679; VI-GISEL-NEXT: v_bfrev_b32_e32 v3, 85680; VI-GISEL-NEXT: v_cmp_lt_f64_e32 vcc, v[0:1], v[2:3]5681; VI-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc5682; VI-GISEL-NEXT: v_lshlrev_b32_e32 v2, 8, v25683; VI-GISEL-NEXT: v_ldexp_f64 v[0:1], v[0:1], v25684; VI-GISEL-NEXT: v_rsq_f64_e32 v[2:3], v[0:1]5685; VI-GISEL-NEXT: v_mul_f64 v[4:5], v[2:3], 0.55686; VI-GISEL-NEXT: v_mul_f64 v[2:3], v[0:1], v[2:3]5687; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[4:5], v[2:3], 0.55688; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[2:3], v[6:7], v[2:3]5689; VI-GISEL-NEXT: v_fma_f64 v[4:5], v[4:5], v[6:7], v[4:5]5690; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]5691; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]5692; VI-GISEL-NEXT: v_fma_f64 v[6:7], -v[2:3], v[2:3], v[0:1]5693; VI-GISEL-NEXT: v_fma_f64 v[2:3], v[6:7], v[4:5], v[2:3]5694; VI-GISEL-NEXT: v_mov_b32_e32 v4, 0xffffff805695; VI-GISEL-NEXT: v_mov_b32_e32 v5, 0x2605696; VI-GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc5697; VI-GISEL-NEXT: v_cmp_class_f64_e32 vcc, v[0:1], v55698; VI-GISEL-NEXT: v_ldexp_f64 v[2:3], v[2:3], v45699; VI-GISEL-NEXT: v_mov_b32_e32 v4, 05700; VI-GISEL-NEXT: v_mov_b32_e32 v5, 0x407000005701; VI-GISEL-NEXT: v_cndmask_b32_e32 v0, v2, v0, vcc5702; VI-GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v1, vcc5703; VI-GISEL-NEXT: v_div_scale_f64 v[2:3], s[4:5], v[0:1], v[0:1], v[4:5]5704; VI-GISEL-NEXT: v_rcp_f64_e32 v[6:7], v[2:3]5705; VI-GISEL-NEXT: v_fma_f64 v[8:9], -v[2:3], v[6:7], 1.05706; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]5707; VI-GISEL-NEXT: v_div_scale_f64 v[8:9], vcc, v[4:5], v[0:1], v[4:5]5708; VI-GISEL-NEXT: v_fma_f64 v[10:11], -v[2:3], v[6:7], 1.05709; VI-GISEL-NEXT: v_fma_f64 v[6:7], v[6:7], v[10:11], v[6:7]5710; VI-GISEL-NEXT: v_mul_f64 v[10:11], v[8:9], v[6:7]5711; VI-GISEL-NEXT: v_fma_f64 v[2:3], -v[2:3], v[10:11], v[8:9]5712; VI-GISEL-NEXT: v_div_fmas_f64 v[2:3], v[2:3], v[6:7], v[10:11]5713; VI-GISEL-NEXT: v_div_fixup_f64 v[0:1], v[2:3], v[0:1], v[4:5]5714; VI-GISEL-NEXT: s_setpc_b64 s[30:31]5715 %sqrt = call contract double @llvm.sqrt.f64(double %x)5716 %rsq = fdiv contract double 256.0, %sqrt5717 ret double %rsq5718}5719 5720;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:5721; GCN: {{.*}}5722; GISEL: {{.*}}5723; SDAG: {{.*}}5724