1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple aarch64 -debugify-and-strip-all-safe -run-pass=aarch64-prelegalizer-combiner --aarch64prelegalizercombiner-only-enable-rule="mulo_by_2" -global-isel -verify-machineinstrs %s -o - | FileCheck %s
7 tracksRegLiveness: true
12 ; CHECK-LABEL: name: smulo_to_saddo
15 ; CHECK-NEXT: %copy:_(s64) = COPY $x0
16 ; CHECK-NEXT: %mul:_(s64), %o:_(s1) = G_SADDO %copy, %copy
17 ; CHECK-NEXT: %overflow_ext:_(s32) = G_ZEXT %o(s1)
18 ; CHECK-NEXT: $w0 = COPY %overflow_ext(s32)
19 ; CHECK-NEXT: RET_ReallyLR implicit $w0
20 %copy:_(s64) = COPY $x0
21 %two:_(s64) = G_CONSTANT i64 2
22 %mul:_(s64), %o:_(s1) = G_SMULO %copy, %two
23 %overflow_ext:_(s32) = G_ZEXT %o(s1)
24 $w0 = COPY %overflow_ext(s32)
25 RET_ReallyLR implicit $w0
29 tracksRegLiveness: true
34 ; CHECK-LABEL: name: umulo_to_uaddo
37 ; CHECK-NEXT: %copy:_(s64) = COPY $x0
38 ; CHECK-NEXT: %mul:_(s64), %o:_(s1) = G_UADDO %copy, %copy
39 ; CHECK-NEXT: %overflow_ext:_(s32) = G_ZEXT %o(s1)
40 ; CHECK-NEXT: $w0 = COPY %overflow_ext(s32)
41 ; CHECK-NEXT: RET_ReallyLR implicit $w0
42 %copy:_(s64) = COPY $x0
43 %two:_(s64) = G_CONSTANT i64 2
44 %mul:_(s64), %o:_(s1) = G_UMULO %copy, %two
45 %overflow_ext:_(s32) = G_ZEXT %o(s1)
46 $w0 = COPY %overflow_ext(s32)
47 RET_ReallyLR implicit $w0
51 tracksRegLiveness: true
56 ; CHECK-LABEL: name: vector
57 ; CHECK: liveins: $d0, $d1
59 ; CHECK-NEXT: %copy:_(<2 x s32>) = COPY $d0
60 ; CHECK-NEXT: %mul:_(<2 x s32>), %o:_(<2 x s1>) = G_SADDO %copy, %copy
61 ; CHECK-NEXT: %overflow_ext:_(<2 x s32>) = G_ANYEXT %o(<2 x s1>)
62 ; CHECK-NEXT: $d0 = COPY %overflow_ext(<2 x s32>)
63 ; CHECK-NEXT: RET_ReallyLR implicit $d0
64 %copy:_(<2 x s32>) = COPY $d0
65 %two:_(s32) = G_CONSTANT i32 2
66 %splat_two:_(<2 x s32>) = G_BUILD_VECTOR %two(s32), %two(s32)
67 %mul:_(<2 x s32>), %o:_(<2 x s1>) = G_SMULO %copy, %splat_two
68 %overflow_ext:_(<2 x s32>) = G_ANYEXT %o(<2 x s1>)
69 $d0 = COPY %overflow_ext(<2 x s32>)
70 RET_ReallyLR implicit $d0
73 name: dont_combine_wrong_cst
74 tracksRegLiveness: true
79 ; CHECK-LABEL: name: dont_combine_wrong_cst
82 ; CHECK-NEXT: %copy:_(s64) = COPY $x0
83 ; CHECK-NEXT: %three:_(s64) = G_CONSTANT i64 3
84 ; CHECK-NEXT: %mul:_(s64), %o:_(s1) = G_UMULO %copy, %three
85 ; CHECK-NEXT: %overflow_ext:_(s32) = G_ZEXT %o(s1)
86 ; CHECK-NEXT: $w0 = COPY %overflow_ext(s32)
87 ; CHECK-NEXT: RET_ReallyLR implicit $w0
88 %copy:_(s64) = COPY $x0
89 %three:_(s64) = G_CONSTANT i64 3
90 %mul:_(s64), %o:_(s1) = G_UMULO %copy, %three
91 %overflow_ext:_(s32) = G_ZEXT %o(s1)
92 $w0 = COPY %overflow_ext(s32)
93 RET_ReallyLR implicit $w0
96 name: dont_combine_not_cst
97 tracksRegLiveness: true
102 ; CHECK-LABEL: name: dont_combine_not_cst
103 ; CHECK: liveins: $x0, $x1
105 ; CHECK-NEXT: %copy1:_(s64) = COPY $x0
106 ; CHECK-NEXT: %copy2:_(s64) = COPY $x1
107 ; CHECK-NEXT: %mul:_(s64), %o:_(s1) = G_UMULO %copy1, %copy2
108 ; CHECK-NEXT: %overflow_ext:_(s32) = G_ZEXT %o(s1)
109 ; CHECK-NEXT: $w0 = COPY %overflow_ext(s32)
110 ; CHECK-NEXT: RET_ReallyLR implicit $w0
111 %copy1:_(s64) = COPY $x0
112 %copy2:_(s64) = COPY $x1
113 %mul:_(s64), %o:_(s1) = G_UMULO %copy1, %copy2
114 %overflow_ext:_(s32) = G_ZEXT %o(s1)
115 $w0 = COPY %overflow_ext(s32)
116 RET_ReallyLR implicit $w0