You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After #126928 it's now
possible to rewrite the existing combines, which mostly only handle
cases where a operand is an identity value, to use existing simplify
code to unlock general constant folding.
; Idempotent fmuls -- should compile to just a ret.
7
7
define <vscale x 8 x half> @idempotent_fmul_f16(<vscale x 8 x i1> %pg, <vscale x 8 x half> %a) #0 {
8
8
; CHECK-LABEL: define <vscale x 8 x half> @idempotent_fmul_f16(
9
-
; CHECK-SAME: <vscale x 8 x i1> [[PG:%.*]], <vscale x 8 x half> [[TMP0:%.*]]) #[[ATTR0:[0-9]+]] {
10
-
; CHECK-NEXT: ret <vscale x 8 x half> [[TMP0]]
9
+
; CHECK-SAME: <vscale x 8 x i1> [[PG:%.*]], <vscale x 8 x half> [[A:%.*]]) #[[ATTR0:[0-9]+]] {
10
+
; CHECK-NEXT: ret <vscale x 8 x half> [[A]]
11
11
;
12
12
%1 = call <vscale x 8 x half> @llvm.aarch64.sve.dup.x.nxv8f16(half1.0)
13
13
%2 = call <vscale x 8 x half> @llvm.aarch64.sve.fmul.nxv8f16(<vscale x 8 x i1> %pg, <vscale x 8 x half> %a, <vscale x 8 x half> %1)
@@ -16,8 +16,8 @@ define <vscale x 8 x half> @idempotent_fmul_f16(<vscale x 8 x i1> %pg, <vscale x
16
16
17
17
define <vscale x 4 x float> @idempotent_fmul_f32(<vscale x 4 x i1> %pg, <vscale x 4 x float> %a) #0 {
18
18
; CHECK-LABEL: define <vscale x 4 x float> @idempotent_fmul_f32(
19
-
; CHECK-SAME: <vscale x 4 x i1> [[PG:%.*]], <vscale x 4 x float> [[TMP0:%.*]]) #[[ATTR0]] {
20
-
; CHECK-NEXT: ret <vscale x 4 x float> [[TMP0]]
19
+
; CHECK-SAME: <vscale x 4 x i1> [[PG:%.*]], <vscale x 4 x float> [[A:%.*]]) #[[ATTR0]] {
20
+
; CHECK-NEXT: ret <vscale x 4 x float> [[A]]
21
21
;
22
22
%1 = call <vscale x 4 x float> @llvm.aarch64.sve.dup.x.nxv4f32(float1.0)
23
23
%2 = call <vscale x 4 x float> @llvm.aarch64.sve.fmul.nxv4f32(<vscale x 4 x i1> %pg, <vscale x 4 x float> %a, <vscale x 4 x float> %1)
@@ -26,8 +26,8 @@ define <vscale x 4 x float> @idempotent_fmul_f32(<vscale x 4 x i1> %pg, <vscale
26
26
27
27
define <vscale x 2 x double> @idempotent_fmul_f64(<vscale x 2 x i1> %pg, <vscale x 2 x double> %a) #0 {
28
28
; CHECK-LABEL: define <vscale x 2 x double> @idempotent_fmul_f64(
29
-
; CHECK-SAME: <vscale x 2 x i1> [[PG:%.*]], <vscale x 2 x double> [[TMP0:%.*]]) #[[ATTR0]] {
30
-
; CHECK-NEXT: ret <vscale x 2 x double> [[TMP0]]
29
+
; CHECK-SAME: <vscale x 2 x i1> [[PG:%.*]], <vscale x 2 x double> [[A:%.*]]) #[[ATTR0]] {
30
+
; CHECK-NEXT: ret <vscale x 2 x double> [[A]]
31
31
;
32
32
%1 = call <vscale x 2 x double> @llvm.aarch64.sve.dup.x.nxv2f64(double1.0)
33
33
%2 = call <vscale x 2 x double> @llvm.aarch64.sve.fmul.nxv2f64(<vscale x 2 x i1> %pg, <vscale x 2 x double> %a, <vscale x 2 x double> %1)
@@ -37,7 +37,7 @@ define <vscale x 2 x double> @idempotent_fmul_f64(<vscale x 2 x i1> %pg, <vscale
37
37
define <vscale x 2 x double> @idempotent_fmul_different_argument_order(<vscale x 2 x i1> %pg, <vscale x 2 x double> %a) #0 {
38
38
; CHECK-LABEL: define <vscale x 2 x double> @idempotent_fmul_different_argument_order(
39
39
; CHECK-SAME: <vscale x 2 x i1> [[PG:%.*]], <vscale x 2 x double> [[A:%.*]]) #[[ATTR0]] {
40
-
; CHECK-NEXT: [[TMP1:%.*]] = call <vscale x 2 x double> @llvm.aarch64.sve.fmul.nxv2f64(<vscale x 2 x i1> [[PG]], <vscale x 2 x double> splat (double 1.000000e+00), <vscale x 2 x double> [[A]])
40
+
; CHECK-NEXT: [[TMP1:%.*]] = select <vscale x 2 x i1> [[PG]], <vscale x 2 x double> [[A]], <vscale x 2 x double> splat (double 1.000000e+00)
41
41
; CHECK-NEXT: ret <vscale x 2 x double> [[TMP1]]
42
42
;
43
43
%1 = call <vscale x 2 x double> @llvm.aarch64.sve.dup.x.nxv2f64(double1.0)
@@ -48,8 +48,8 @@ define <vscale x 2 x double> @idempotent_fmul_different_argument_order(<vscale x
48
48
49
49
define <vscale x 8 x half> @idempotent_fmul_with_predicated_dup(<vscale x 8 x i1> %pg, <vscale x 8 x half> %a) #0 {
50
50
; CHECK-LABEL: define <vscale x 8 x half> @idempotent_fmul_with_predicated_dup(
51
-
; CHECK-SAME: <vscale x 8 x i1> [[PG:%.*]], <vscale x 8 x half> [[TMP0:%.*]]) #[[ATTR0]] {
52
-
; CHECK-NEXT: ret <vscale x 8 x half> [[TMP0]]
51
+
; CHECK-SAME: <vscale x 8 x i1> [[PG:%.*]], <vscale x 8 x half> [[A:%.*]]) #[[ATTR0]] {
52
+
; CHECK-NEXT: ret <vscale x 8 x half> [[A]]
53
53
;
54
54
%1 = call <vscale x 8 x half> @llvm.aarch64.sve.dup.nxv8f16(<vscale x 8 x half> poison, <vscale x 8 x i1> %pg, half1.0)
55
55
%2 = call <vscale x 8 x half> @llvm.aarch64.sve.fmul.nxv8f16(<vscale x 8 x i1> %pg, <vscale x 8 x half> %a, <vscale x 8 x half> %1)
Copy file name to clipboardExpand all lines: llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-fmul_u-idempotency.ll
+2-3Lines changed: 2 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -36,9 +36,8 @@ define <vscale x 2 x double> @idempotent_fmul_u_f64(<vscale x 2 x i1> %pg, <vsca
36
36
37
37
define <vscale x 2 x double> @idempotent_fmul_u_different_argument_order(<vscale x 2 x i1> %pg, <vscale x 2 x double> %a) #0 {
38
38
; CHECK-LABEL: define <vscale x 2 x double> @idempotent_fmul_u_different_argument_order(
39
-
; CHECK-SAME: <vscale x 2 x i1> [[PG:%.*]], <vscale x 2 x double> [[A:%.*]]) #[[ATTR0]] {
40
-
; CHECK-NEXT: [[TMP1:%.*]] = call <vscale x 2 x double> @llvm.aarch64.sve.fmul.u.nxv2f64(<vscale x 2 x i1> [[PG]], <vscale x 2 x double> splat (double 1.000000e+00), <vscale x 2 x double> [[A]])
41
-
; CHECK-NEXT: ret <vscale x 2 x double> [[TMP1]]
39
+
; CHECK-SAME: <vscale x 2 x i1> [[PG:%.*]], <vscale x 2 x double> [[TMP0:%.*]]) #[[ATTR0]] {
40
+
; CHECK-NEXT: ret <vscale x 2 x double> [[TMP0]]
42
41
;
43
42
%1 = call <vscale x 2 x double> @llvm.aarch64.sve.dup.x.nxv2f64(double1.0)
; Idempotent muls -- should compile to just a ret.
7
7
define <vscale x 8 x i16> @idempotent_mul_i16(<vscale x 8 x i1> %pg, <vscale x 8 x i16> %a) #0 {
8
8
; CHECK-LABEL: define <vscale x 8 x i16> @idempotent_mul_i16(
9
-
; CHECK-SAME: <vscale x 8 x i1> [[PG:%.*]], <vscale x 8 x i16> [[TMP0:%.*]]) #[[ATTR0:[0-9]+]] {
10
-
; CHECK-NEXT: ret <vscale x 8 x i16> [[TMP0]]
9
+
; CHECK-SAME: <vscale x 8 x i1> [[PG:%.*]], <vscale x 8 x i16> [[A:%.*]]) #[[ATTR0:[0-9]+]] {
10
+
; CHECK-NEXT: ret <vscale x 8 x i16> [[A]]
11
11
;
12
12
%1 = call <vscale x 8 x i16> @llvm.aarch64.sve.dup.x.nxv8i16(i161)
13
13
%2 = call <vscale x 8 x i16> @llvm.aarch64.sve.mul.nxv8i16(<vscale x 8 x i1> %pg, <vscale x 8 x i16> %a, <vscale x 8 x i16> %1)
@@ -16,8 +16,8 @@ define <vscale x 8 x i16> @idempotent_mul_i16(<vscale x 8 x i1> %pg, <vscale x 8
16
16
17
17
define <vscale x 4 x i32> @idempotent_mul_i32(<vscale x 4 x i1> %pg, <vscale x 4 x i32> %a) #0 {
18
18
; CHECK-LABEL: define <vscale x 4 x i32> @idempotent_mul_i32(
19
-
; CHECK-SAME: <vscale x 4 x i1> [[PG:%.*]], <vscale x 4 x i32> [[TMP0:%.*]]) #[[ATTR0]] {
20
-
; CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
19
+
; CHECK-SAME: <vscale x 4 x i1> [[PG:%.*]], <vscale x 4 x i32> [[A:%.*]]) #[[ATTR0]] {
20
+
; CHECK-NEXT: ret <vscale x 4 x i32> [[A]]
21
21
;
22
22
%1 = call <vscale x 4 x i32> @llvm.aarch64.sve.dup.x.nxv4i32(i321)
23
23
%2 = call <vscale x 4 x i32> @llvm.aarch64.sve.mul.nxv4i32(<vscale x 4 x i1> %pg, <vscale x 4 x i32> %a, <vscale x 4 x i32> %1)
@@ -26,8 +26,8 @@ define <vscale x 4 x i32> @idempotent_mul_i32(<vscale x 4 x i1> %pg, <vscale x 4
26
26
27
27
define <vscale x 2 x i64> @idempotent_mul_i64(<vscale x 2 x i1> %pg, <vscale x 2 x i64> %a) #0 {
28
28
; CHECK-LABEL: define <vscale x 2 x i64> @idempotent_mul_i64(
29
-
; CHECK-SAME: <vscale x 2 x i1> [[PG:%.*]], <vscale x 2 x i64> [[TMP0:%.*]]) #[[ATTR0]] {
30
-
; CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]
29
+
; CHECK-SAME: <vscale x 2 x i1> [[PG:%.*]], <vscale x 2 x i64> [[A:%.*]]) #[[ATTR0]] {
30
+
; CHECK-NEXT: ret <vscale x 2 x i64> [[A]]
31
31
;
32
32
%1 = call <vscale x 2 x i64> @llvm.aarch64.sve.dup.x.nxv2i64(i641)
33
33
%2 = call <vscale x 2 x i64> @llvm.aarch64.sve.mul.nxv2i64(<vscale x 2 x i1> %pg, <vscale x 2 x i64> %a, <vscale x 2 x i64> %1)
@@ -37,7 +37,7 @@ define <vscale x 2 x i64> @idempotent_mul_i64(<vscale x 2 x i1> %pg, <vscale x 2
37
37
define <vscale x 2 x i64> @idempotent_mul_different_argument_order(<vscale x 2 x i1> %pg, <vscale x 2 x i64> %a) #0 {
38
38
; CHECK-LABEL: define <vscale x 2 x i64> @idempotent_mul_different_argument_order(
39
39
; CHECK-SAME: <vscale x 2 x i1> [[PG:%.*]], <vscale x 2 x i64> [[A:%.*]]) #[[ATTR0]] {
40
-
; CHECK-NEXT: [[TMP1:%.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.mul.nxv2i64(<vscale x 2 x i1> [[PG]], <vscale x 2 x i64> splat (i64 1), <vscale x 2 x i64> [[A]])
40
+
; CHECK-NEXT: [[TMP1:%.*]] = select <vscale x 2 x i1> [[PG]], <vscale x 2 x i64> [[A]], <vscale x 2 x i64> splat (i64 1)
41
41
; CHECK-NEXT: ret <vscale x 2 x i64> [[TMP1]]
42
42
;
43
43
%1 = call <vscale x 2 x i64> @llvm.aarch64.sve.dup.x.nxv2i64(i641)
@@ -48,8 +48,8 @@ define <vscale x 2 x i64> @idempotent_mul_different_argument_order(<vscale x 2 x
48
48
49
49
define <vscale x 8 x i16> @idempotent_mul_with_predicated_dup(<vscale x 8 x i1> %pg, <vscale x 8 x i16> %a) #0 {
50
50
; CHECK-LABEL: define <vscale x 8 x i16> @idempotent_mul_with_predicated_dup(
51
-
; CHECK-SAME: <vscale x 8 x i1> [[PG:%.*]], <vscale x 8 x i16> [[TMP0:%.*]]) #[[ATTR0]] {
52
-
; CHECK-NEXT: ret <vscale x 8 x i16> [[TMP0]]
51
+
; CHECK-SAME: <vscale x 8 x i1> [[PG:%.*]], <vscale x 8 x i16> [[A:%.*]]) #[[ATTR0]] {
52
+
; CHECK-NEXT: ret <vscale x 8 x i16> [[A]]
53
53
;
54
54
%1 = call <vscale x 8 x i16> @llvm.aarch64.sve.dup.nxv8i16(<vscale x 8 x i16> poison, <vscale x 8 x i1> %pg, i161)
55
55
%2 = call <vscale x 8 x i16> @llvm.aarch64.sve.mul.nxv8i16(<vscale x 8 x i1> %pg, <vscale x 8 x i16> %a, <vscale x 8 x i16> %1)
Copy file name to clipboardExpand all lines: llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-mul_u-idempotency.ll
+2-3Lines changed: 2 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -36,9 +36,8 @@ define <vscale x 2 x i64> @idempotent_mul_u_i64(<vscale x 2 x i1> %pg, <vscale x
36
36
37
37
define <vscale x 2 x i64> @idempotent_mul_u_different_argument_order(<vscale x 2 x i1> %pg, <vscale x 2 x i64> %a) #0 {
38
38
; CHECK-LABEL: define <vscale x 2 x i64> @idempotent_mul_u_different_argument_order(
39
-
; CHECK-SAME: <vscale x 2 x i1> [[PG:%.*]], <vscale x 2 x i64> [[A:%.*]]) #[[ATTR0]] {
40
-
; CHECK-NEXT: [[TMP1:%.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.mul.u.nxv2i64(<vscale x 2 x i1> [[PG]], <vscale x 2 x i64> splat (i64 1), <vscale x 2 x i64> [[A]])
41
-
; CHECK-NEXT: ret <vscale x 2 x i64> [[TMP1]]
39
+
; CHECK-SAME: <vscale x 2 x i1> [[PG:%.*]], <vscale x 2 x i64> [[TMP0:%.*]]) #[[ATTR0]] {
40
+
; CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]
42
41
;
43
42
%1 = call <vscale x 2 x i64> @llvm.aarch64.sve.dup.x.nxv2i64(i641)
0 commit comments