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
40 ; CHECK-CSSC-LABEL: name: s32
41 ; CHECK-CSSC: liveins: $w0
42 ; CHECK-CSSC-NEXT: {{ $}}
43 ; CHECK-CSSC-NEXT: %copy:_(s32) = COPY $w0
44 ; CHECK-CSSC-NEXT: %ctpop:_(s32) = G_CTPOP %copy(s32)
45 ; CHECK-CSSC-NEXT: $w0 = COPY %ctpop(s32)
46 ; CHECK-CSSC-NEXT: RET_ReallyLR implicit $w0
47 %copy:_(s32) = COPY $w0
48 %ctpop:_(s32) = G_CTPOP %copy(s32)
49 $w0 = COPY %ctpop(s32)
50 RET_ReallyLR implicit $w0
55 tracksRegLiveness: true
59 ; CHECK-LABEL: name: s64
62 ; CHECK-NEXT: %copy:_(s64) = COPY $x0
63 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
64 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR %copy, [[C]](s64)
65 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 6148914691236517205
66 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[LSHR]], [[C1]]
67 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB %copy, [[AND]]
68 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 2
69 ; CHECK-NEXT: [[LSHR1:%[0-9]+]]:_(s64) = G_LSHR [[SUB]], [[C2]](s64)
70 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 3689348814741910323
71 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[LSHR1]], [[C3]]
72 ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s64) = G_AND [[SUB]], [[C3]]
73 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[AND1]], [[AND2]]
74 ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 4
75 ; CHECK-NEXT: [[LSHR2:%[0-9]+]]:_(s64) = G_LSHR [[ADD]], [[C4]](s64)
76 ; CHECK-NEXT: [[ADD1:%[0-9]+]]:_(s64) = G_ADD [[LSHR2]], [[ADD]]
77 ; CHECK-NEXT: [[C5:%[0-9]+]]:_(s64) = G_CONSTANT i64 1085102592571150095
78 ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s64) = G_AND [[ADD1]], [[C5]]
79 ; CHECK-NEXT: [[C6:%[0-9]+]]:_(s64) = G_CONSTANT i64 72340172838076673
80 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s64) = G_MUL [[AND3]], [[C6]]
81 ; CHECK-NEXT: [[C7:%[0-9]+]]:_(s64) = G_CONSTANT i64 56
82 ; CHECK-NEXT: %ctpop:_(s64) = G_LSHR [[MUL]], [[C7]](s64)
83 ; CHECK-NEXT: $x0 = COPY %ctpop(s64)
84 ; CHECK-NEXT: RET_ReallyLR implicit $x0
85 ; CHECK-CSSC-LABEL: name: s64
86 ; CHECK-CSSC: liveins: $x0
87 ; CHECK-CSSC-NEXT: {{ $}}
88 ; CHECK-CSSC-NEXT: %copy:_(s64) = COPY $x0
89 ; CHECK-CSSC-NEXT: %ctpop:_(s64) = G_CTPOP %copy(s64)
90 ; CHECK-CSSC-NEXT: $x0 = COPY %ctpop(s64)
91 ; CHECK-CSSC-NEXT: RET_ReallyLR implicit $x0
92 %copy:_(s64) = COPY $x0
93 %ctpop:_(s64) = G_CTPOP %copy(s64)
94 $x0 = COPY %ctpop(s64)
95 RET_ReallyLR implicit $x0