ret float %w
}
+; CHECK-LABEL: repeated_div_recip_allowed_sel
+define float @repeated_div_recip_allowed_sel(i1 %pred, float %a, float %b, float %divisor) {
+; CHECK: selp.f32
+; CHECK: div.rn.f32
+ %x = fdiv arcp float %a, %divisor
+ %y = fdiv arcp float %b, %divisor
+ %w = select i1 %pred, float %x, float %y
+ ret float %w
+}
+
; CHECK-LABEL: repeated_div_recip_allowed_ftz
define float @repeated_div_recip_allowed_ftz(i1 %pred, float %a, float %b, float %divisor) #1 {
; CHECK: rcp.rn.ftz.f32
ret float %w
}
+; CHECK-LABEL: repeated_div_recip_allowed_ftz_sel
+define float @repeated_div_recip_allowed_ftz_sel(i1 %pred, float %a, float %b, float %divisor) #1 {
+; CHECK: selp.f32
+; CHECK: div.rn.ftz.f32
+ %x = fdiv arcp float %a, %divisor
+ %y = fdiv arcp float %b, %divisor
+ %w = select i1 %pred, float %x, float %y
+ ret float %w
+}
+
; CHECK-LABEL: repeated_div_fast
define float @repeated_div_fast(i1 %pred, float %a, float %b, float %divisor) #0 {
; CHECK: rcp.approx.f32
ret float %w
}
+; CHECK-LABEL: repeated_div_fast_sel
+define float @repeated_div_fast_sel(i1 %pred, float %a, float %b, float %divisor) #0 {
+; CHECK: selp.f32
+; CHECK: div.approx.f32
+ %x = fdiv float %a, %divisor
+ %y = fdiv float %b, %divisor
+ %w = select i1 %pred, float %x, float %y
+ ret float %w
+}
+
; CHECK-LABEL: repeated_div_fast_ftz
define float @repeated_div_fast_ftz(i1 %pred, float %a, float %b, float %divisor) #0 #1 {
; CHECK: rcp.approx.ftz.f32
ret float %w
}
+; CHECK-LABEL: repeated_div_fast_ftz_sel
+define float @repeated_div_fast_ftz_sel(i1 %pred, float %a, float %b, float %divisor) #0 #1 {
+; CHECK: selp.f32
+; CHECK: div.approx.ftz.f32
+ %x = fdiv float %a, %divisor
+ %y = fdiv float %b, %divisor
+ %w = select i1 %pred, float %x, float %y
+ ret float %w
+}
+
attributes #0 = { "unsafe-fp-math" = "true" }
attributes #1 = { "denormal-fp-math-f32" = "preserve-sign" }