1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=aarch64-unknown-unknown -verify-machineinstrs -run-pass=legalizer %s -o - 2>&1 | FileCheck %s
3 # RUN: llc -mtriple=aarch64-unknown-unknown -verify-machineinstrs -run-pass=legalizer -mattr=+cssc %s -o - | FileCheck %s --check-prefix=CHECK-CSSC
5 define void @s32() noimplicitfloat { unreachable }
6 define void @s64() noimplicitfloat { unreachable }
10 tracksRegLiveness: true
14 ; CHECK-LABEL: name: s32
17 ; CHECK-NEXT: %copy:_(s32) = COPY $w0
18 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
19 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR %copy, [[C]](s64)
20 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1431655765
21 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[LSHR]], [[C1]]
22 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB %copy, [[AND]]
23 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 2
24 ; CHECK-NEXT: [[LSHR1:%[0-9]+]]:_(s32) = G_LSHR [[SUB]], [[C2]](s64)
25 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 858993459
26 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[LSHR1]], [[C3]]
27 ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s32) = G_AND [[SUB]], [[C3]]
28 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[AND1]], [[AND2]]
29 ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 4
30 ; CHECK-NEXT: [[LSHR2:%[0-9]+]]:_(s32) = G_LSHR [[ADD]], [[C4]](s64)
31 ; CHECK-NEXT: [[ADD1:%[0-9]+]]:_(s32) = G_ADD [[LSHR2]], [[ADD]]
32 ; CHECK-NEXT: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 252645135
33 ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s32) = G_AND [[ADD1]], [[C5]]
34 ; CHECK-NEXT: [[C6:%[0-9]+]]:_(s32) = G_CONSTANT i32 16843009
35 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s32) = G_MUL [[AND3]], [[C6]]
36 ; CHECK-NEXT: [[C7:%[0-9]+]]:_(s64) = G_CONSTANT i64 24
37 ; CHECK-NEXT: %ctpop:_(s32) = G_LSHR [[MUL]], [[C7]](s64)
38 ; CHECK-NEXT: $w0 = COPY %ctpop(s32)
39 ; CHECK-NEXT: RET_ReallyLR implicit $w0
41 ; CHECK-CSSC-LABEL: name: s32
42 ; CHECK-CSSC: liveins: $w0
43 ; CHECK-CSSC-NEXT: {{ $}}
44 ; CHECK-CSSC-NEXT: %copy:_(s32) = COPY $w0
45 ; CHECK-CSSC-NEXT: %ctpop:_(s32) = G_CTPOP %copy(s32)
46 ; CHECK-CSSC-NEXT: $w0 = COPY %ctpop(s32)
47 ; CHECK-CSSC-NEXT: RET_ReallyLR implicit $w0
48 %copy:_(s32) = COPY $w0
49 %ctpop:_(s32) = G_CTPOP %copy(s32)
50 $w0 = COPY %ctpop(s32)
51 RET_ReallyLR implicit $w0
56 tracksRegLiveness: true
60 ; CHECK-LABEL: name: s64
63 ; CHECK-NEXT: %copy:_(s64) = COPY $x0
64 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
65 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR %copy, [[C]](s64)
66 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 6148914691236517205
67 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[LSHR]], [[C1]]
68 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB %copy, [[AND]]
69 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 2
70 ; CHECK-NEXT: [[LSHR1:%[0-9]+]]:_(s64) = G_LSHR [[SUB]], [[C2]](s64)
71 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 3689348814741910323
72 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[LSHR1]], [[C3]]
73 ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s64) = G_AND [[SUB]], [[C3]]
74 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[AND1]], [[AND2]]
75 ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 4
76 ; CHECK-NEXT: [[LSHR2:%[0-9]+]]:_(s64) = G_LSHR [[ADD]], [[C4]](s64)
77 ; CHECK-NEXT: [[ADD1:%[0-9]+]]:_(s64) = G_ADD [[LSHR2]], [[ADD]]
78 ; CHECK-NEXT: [[C5:%[0-9]+]]:_(s64) = G_CONSTANT i64 1085102592571150095
79 ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s64) = G_AND [[ADD1]], [[C5]]
80 ; CHECK-NEXT: [[C6:%[0-9]+]]:_(s64) = G_CONSTANT i64 72340172838076673
81 ; CHECK-NEXT: [[C7:%[0-9]+]]:_(s64) = G_CONSTANT i64 56
82 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s64) = G_MUL [[AND3]], [[C6]]
83 ; CHECK-NEXT: %ctpop:_(s64) = G_LSHR [[MUL]], [[C7]](s64)
84 ; CHECK-NEXT: $x0 = COPY %ctpop(s64)
85 ; CHECK-NEXT: RET_ReallyLR implicit $x0
87 ; CHECK-CSSC-LABEL: name: s64
88 ; CHECK-CSSC: liveins: $x0
89 ; CHECK-CSSC-NEXT: {{ $}}
90 ; CHECK-CSSC-NEXT: %copy:_(s64) = COPY $x0
91 ; CHECK-CSSC-NEXT: %ctpop:_(s64) = G_CTPOP %copy(s64)
92 ; CHECK-CSSC-NEXT: $x0 = COPY %ctpop(s64)
93 ; CHECK-CSSC-NEXT: RET_ReallyLR implicit $x0
94 %copy:_(s64) = COPY $x0
95 %ctpop:_(s64) = G_CTPOP %copy(s64)
96 $x0 = COPY %ctpop(s64)
97 RET_ReallyLR implicit $x0