[llvm] e50189b - [InstCombine] Add additional tests for fdiv-sqrt
Zain Jaffal via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 8 04:37:30 PST 2024
Author: Zain Jaffal
Date: 2024-02-08T12:36:49Z
New Revision: e50189b0fdf382e3e0d5fc5e58fe81a78d0de7c8
URL: https://github.com/llvm/llvm-project/commit/e50189b0fdf382e3e0d5fc5e58fe81a78d0de7c8
DIFF: https://github.com/llvm/llvm-project/commit/e50189b0fdf382e3e0d5fc5e58fe81a78d0de7c8.diff
LOG: [InstCombine] Add additional tests for fdiv-sqrt
Add more tests where some of the instructions have missing flags.
Added:
Modified:
llvm/test/Transforms/InstCombine/fdiv-sqrt.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/fdiv-sqrt.ll b/llvm/test/Transforms/InstCombine/fdiv-sqrt.ll
index a8d4b6d5d622d..346271be7da76 100644
--- a/llvm/test/Transforms/InstCombine/fdiv-sqrt.ll
+++ b/llvm/test/Transforms/InstCombine/fdiv-sqrt.ll
@@ -42,9 +42,99 @@ define double @sqrt_div_reassoc_arcp(double %x, double %y, double %z) {
; CHECK-NEXT: ret double [[DIV1]]
;
entry:
- %div = fdiv reassoc arcp double %y, %z
- %sqrt = call reassoc arcp double @llvm.sqrt.f64(double %div)
- %div1 = fdiv reassoc arcp double %x, %sqrt
+ %div = fdiv arcp reassoc double %y, %z
+ %sqrt = call arcp reassoc double @llvm.sqrt.f64(double %div)
+ %div1 = fdiv arcp reassoc double %x, %sqrt
+ ret double %div1
+}
+
+define double @sqrt_div_reassoc_missing(double %x, double %y, double %z) {
+; CHECK-LABEL: @sqrt_div_reassoc_missing(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[DIV:%.*]] = fdiv arcp double [[Y:%.*]], [[Z:%.*]]
+; CHECK-NEXT: [[SQRT:%.*]] = call reassoc arcp double @llvm.sqrt.f64(double [[DIV]])
+; CHECK-NEXT: [[DIV1:%.*]] = fdiv reassoc arcp double [[X:%.*]], [[SQRT]]
+; CHECK-NEXT: ret double [[DIV1]]
+;
+entry:
+ %div = fdiv arcp double %y, %z
+ %sqrt = call arcp reassoc double @llvm.sqrt.f64(double %div)
+ %div1 = fdiv arcp reassoc double %x, %sqrt
+ ret double %div1
+}
+
+define double @sqrt_div_reassoc_missing2(double %x, double %y, double %z) {
+; CHECK-LABEL: @sqrt_div_reassoc_missing2(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[DIV:%.*]] = fdiv reassoc arcp double [[Y:%.*]], [[Z:%.*]]
+; CHECK-NEXT: [[SQRT:%.*]] = call arcp double @llvm.sqrt.f64(double [[DIV]])
+; CHECK-NEXT: [[DIV1:%.*]] = fdiv reassoc arcp double [[X:%.*]], [[SQRT]]
+; CHECK-NEXT: ret double [[DIV1]]
+;
+entry:
+ %div = fdiv arcp reassoc double %y, %z
+ %sqrt = call arcp double @llvm.sqrt.f64(double %div)
+ %div1 = fdiv arcp reassoc double %x, %sqrt
+ ret double %div1
+}
+
+define double @sqrt_div_reassoc_missing3(double %x, double %y, double %z) {
+; CHECK-LABEL: @sqrt_div_reassoc_missing3(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[DIV:%.*]] = fdiv reassoc arcp double [[Y:%.*]], [[Z:%.*]]
+; CHECK-NEXT: [[SQRT:%.*]] = call reassoc arcp double @llvm.sqrt.f64(double [[DIV]])
+; CHECK-NEXT: [[DIV1:%.*]] = fdiv arcp double [[X:%.*]], [[SQRT]]
+; CHECK-NEXT: ret double [[DIV1]]
+;
+entry:
+ %div = fdiv arcp reassoc double %y, %z
+ %sqrt = call arcp reassoc double @llvm.sqrt.f64(double %div)
+ %div1 = fdiv arcp double %x, %sqrt
+ ret double %div1
+}
+
+define double @sqrt_div_arcp_missing(double %x, double %y, double %z) {
+; CHECK-LABEL: @sqrt_div_arcp_missing(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[DIV:%.*]] = fdiv reassoc double [[Y:%.*]], [[Z:%.*]]
+; CHECK-NEXT: [[SQRT:%.*]] = call reassoc arcp double @llvm.sqrt.f64(double [[DIV]])
+; CHECK-NEXT: [[DIV1:%.*]] = fdiv reassoc arcp double [[X:%.*]], [[SQRT]]
+; CHECK-NEXT: ret double [[DIV1]]
+;
+entry:
+ %div = fdiv reassoc double %y, %z
+ %sqrt = call arcp reassoc double @llvm.sqrt.f64(double %div)
+ %div1 = fdiv arcp reassoc double %x, %sqrt
+ ret double %div1
+}
+
+define double @sqrt_div_arcp_missing2(double %x, double %y, double %z) {
+; CHECK-LABEL: @sqrt_div_arcp_missing2(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[DIV:%.*]] = fdiv reassoc arcp double [[Y:%.*]], [[Z:%.*]]
+; CHECK-NEXT: [[SQRT:%.*]] = call reassoc double @llvm.sqrt.f64(double [[DIV]])
+; CHECK-NEXT: [[DIV1:%.*]] = fdiv reassoc arcp double [[X:%.*]], [[SQRT]]
+; CHECK-NEXT: ret double [[DIV1]]
+;
+entry:
+ %div = fdiv arcp reassoc double %y, %z
+ %sqrt = call reassoc double @llvm.sqrt.f64(double %div)
+ %div1 = fdiv arcp reassoc double %x, %sqrt
+ ret double %div1
+}
+
+define double @sqrt_div_arcp_missing3(double %x, double %y, double %z) {
+; CHECK-LABEL: @sqrt_div_arcp_missing3(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[DIV:%.*]] = fdiv reassoc arcp double [[Y:%.*]], [[Z:%.*]]
+; CHECK-NEXT: [[SQRT:%.*]] = call reassoc arcp double @llvm.sqrt.f64(double [[DIV]])
+; CHECK-NEXT: [[DIV1:%.*]] = fdiv reassoc double [[X:%.*]], [[SQRT]]
+; CHECK-NEXT: ret double [[DIV1]]
+;
+entry:
+ %div = fdiv arcp reassoc double %y, %z
+ %sqrt = call arcp reassoc double @llvm.sqrt.f64(double %div)
+ %div1 = fdiv reassoc double %x, %sqrt
ret double %div1
}
More information about the llvm-commits
mailing list