ret double %div
}
+define double @fabs_copysign_commuted(double %x) {
+; CHECK-LABEL: @fabs_copysign_commuted(
+; CHECK-NEXT: [[F:%.*]] = tail call double @llvm.fabs.f64(double [[X:%.*]])
+; CHECK-NEXT: [[DIV:%.*]] = fdiv nnan ninf double [[F]], [[X]]
+; CHECK-NEXT: ret double [[DIV]]
+;
+ %f = tail call double @llvm.fabs.f64(double %x)
+ %div = fdiv nnan ninf double %f, %x
+ ret double %div
+}
+
define float @fabs_copysignf(float %x) {
; CHECK-LABEL: @fabs_copysignf(
define double @fabs_copysign_use(double %x) {
; CHECK-LABEL: @fabs_copysign_use(
; CHECK-NEXT: [[F:%.*]] = tail call double @llvm.fabs.f64(double [[X:%.*]])
+; CHECK-NEXT: call void @use(double [[F]])
; CHECK-NEXT: [[DIV:%.*]] = fdiv nnan ninf double [[X]], [[F]]
; CHECK-NEXT: ret double [[DIV]]
;
%f = tail call double @llvm.fabs.f64(double %x)
+ call void @use(double %f)
%div = fdiv nnan ninf double %x, %f
ret double %div
}
ret double %div
}
+define double @fabs_copysign_commuted_mismatch(double %x, double %y) {
+; CHECK-LABEL: @fabs_copysign_commuted_mismatch(
+; CHECK-NEXT: [[F:%.*]] = tail call double @llvm.fabs.f64(double [[Y:%.*]])
+; CHECK-NEXT: [[DIV:%.*]] = fdiv double [[F]], [[X:%.*]]
+; CHECK-NEXT: ret double [[DIV]]
+;
+ %f = tail call double @llvm.fabs.f64(double %y)
+ %div = fdiv double %f, %x
+ ret double %div
+}
+
define double @fabs_copysign_no_nnan(double %x) {
; CHECK-LABEL: @fabs_copysign_no_nnan(
; CHECK-NEXT: [[F:%.*]] = tail call double @llvm.fabs.f64(double [[X:%.*]])