1// RUN: llvm-mc -triple aarch64-none-linux-gnu -mattr=+neon -show-encoding < %s | FileCheck %s
2
3// Check that the assembler can handle the documented syntax for AArch64
4
5//----------------------------------------------------------------------
6// Scalar Signed Shift Right (Immediate)
7//----------------------------------------------------------------------
8        sshr d15, d16, #12
9
10// CHECK: sshr d15, d16, #12  // encoding: [0x0f,0x06,0x74,0x5f]
11
12//----------------------------------------------------------------------
13// Scalar Unsigned Shift Right (Immediate)
14//----------------------------------------------------------------------
15        ushr d10, d17, #18
16
17// CHECK: ushr d10, d17, #18  // encoding: [0x2a,0x06,0x6e,0x7f]
18
19//----------------------------------------------------------------------
20// Scalar Signed Rounding Shift Right (Immediate)
21//----------------------------------------------------------------------
22        srshr d19, d18, #7
23
24// CHECK: srshr d19, d18, #7  // encoding: [0x53,0x26,0x79,0x5f]
25
26//----------------------------------------------------------------------
27// Scalar Unigned Rounding Shift Right (Immediate)
28//----------------------------------------------------------------------
29        urshr d20, d23, #31
30
31// CHECK: urshr d20, d23, #31  // encoding: [0xf4,0x26,0x61,0x7f]
32
33//----------------------------------------------------------------------
34// Scalar Signed Shift Right and Accumulate (Immediate)
35//----------------------------------------------------------------------
36        ssra d18, d12, #21
37
38// CHECK: ssra d18, d12, #21  // encoding: [0x92,0x15,0x6b,0x5f]
39
40//----------------------------------------------------------------------
41// Scalar Unsigned Shift Right and Accumulate (Immediate)
42//----------------------------------------------------------------------
43        usra d20, d13, #61
44
45// CHECK: usra d20, d13, #61  // encoding: [0xb4,0x15,0x43,0x7f]
46
47//----------------------------------------------------------------------
48// Scalar Signed Rounding Shift Right and Accumulate (Immediate)
49//----------------------------------------------------------------------
50        srsra d15, d11, #19
51
52// CHECK: srsra d15, d11, #19  // encoding: [0x6f,0x35,0x6d,0x5f]
53
54//----------------------------------------------------------------------
55// Scalar Unsigned Rounding Shift Right and Accumulate (Immediate)
56//----------------------------------------------------------------------
57        ursra d18, d10, #13
58
59// CHECK: ursra d18, d10, #13  // encoding: [0x52,0x35,0x73,0x7f]
60
61//----------------------------------------------------------------------
62// Scalar Shift Left (Immediate)
63//----------------------------------------------------------------------
64        shl d7, d10, #12
65
66// CHECK: shl d7, d10, #12  // encoding: [0x47,0x55,0x4c,0x5f]
67
68//----------------------------------------------------------------------
69// Signed Saturating Shift Left (Immediate)
70//----------------------------------------------------------------------
71        sqshl b11, b19, #7
72        sqshl h13, h18, #11
73        sqshl s14, s17, #22
74        sqshl d15, d16, #51
75
76// CHECK: sqshl b11, b19, #7   // encoding: [0x6b,0x76,0x0f,0x5f]
77// CHECK: sqshl h13, h18, #11  // encoding: [0x4d,0x76,0x1b,0x5f]
78// CHECK: sqshl s14, s17, #22  // encoding: [0x2e,0x76,0x36,0x5f]
79// CHECK: sqshl d15, d16, #51  // encoding: [0x0f,0x76,0x73,0x5f]
80
81//----------------------------------------------------------------------
82// Unsigned Saturating Shift Left (Immediate)
83//----------------------------------------------------------------------
84        uqshl b18, b15, #6
85        uqshl h11, h18, #7
86        uqshl s14, s19, #18
87        uqshl d15, d12, #19
88
89// CHECK: uqshl b18, b15, #6   // encoding: [0xf2,0x75,0x0e,0x7f]
90// CHECK: uqshl h11, h18, #7   // encoding: [0x4b,0x76,0x17,0x7f]
91// CHECK: uqshl s14, s19, #18  // encoding: [0x6e,0x76,0x32,0x7f]
92// CHECK: uqshl d15, d12, #19  // encoding: [0x8f,0x75,0x53,0x7f]
93
94//----------------------------------------------------------------------
95// Signed Saturating Shift Left Unsigned (Immediate)
96//----------------------------------------------------------------------
97        sqshlu b15, b18, #6
98        sqshlu h19, h17, #6
99        sqshlu s16, s14, #25
100        sqshlu d11, d13, #32
101
102// CHECK: sqshlu  b15, b18, #6   // encoding: [0x4f,0x66,0x0e,0x7f]
103// CHECK: sqshlu  h19, h17, #6   // encoding: [0x33,0x66,0x16,0x7f]
104// CHECK: sqshlu  s16, s14, #25  // encoding: [0xd0,0x65,0x39,0x7f]
105// CHECK: sqshlu  d11, d13, #32  // encoding: [0xab,0x65,0x60,0x7f]
106
107//----------------------------------------------------------------------
108// Shift Right And Insert (Immediate)
109//----------------------------------------------------------------------
110        sri d10, d12, #14
111
112// CHECK: sri d10, d12, #14  // encoding: [0x8a,0x45,0x72,0x7f]
113
114//----------------------------------------------------------------------
115// Shift Left And Insert (Immediate)
116//----------------------------------------------------------------------
117        sli d10, d14, #12
118
119// CHECK: sli d10, d14, #12  // encoding: [0xca,0x55,0x4c,0x7f]
120
121//----------------------------------------------------------------------
122// Signed Saturating Shift Right Narrow (Immediate)
123//----------------------------------------------------------------------
124        sqshrn b10, h15, #5
125        sqshrn h17, s10, #4
126        sqshrn s18, d10, #31
127
128// CHECK: sqshrn  b10, h15, #5   // encoding: [0xea,0x95,0x0b,0x5f]
129// CHECK: sqshrn  h17, s10, #4   // encoding: [0x51,0x95,0x1c,0x5f]
130// CHECK: sqshrn  s18, d10, #31  // encoding: [0x52,0x95,0x21,0x5f]
131
132//----------------------------------------------------------------------
133// Unsigned Saturating Shift Right Narrow (Immediate)
134//----------------------------------------------------------------------
135        uqshrn b12, h10, #7
136        uqshrn h10, s14, #5
137        uqshrn s10, d12, #13
138
139// CHECK: uqshrn  b12, h10, #7   // encoding: [0x4c,0x95,0x09,0x7f]
140// CHECK: uqshrn  h10, s14, #5   // encoding: [0xca,0x95,0x1b,0x7f]
141// CHECK: uqshrn  s10, d12, #13  // encoding: [0x8a,0x95,0x33,0x7f]
142
143//----------------------------------------------------------------------
144// Signed Saturating Rounded Shift Right Narrow (Immediate)
145//----------------------------------------------------------------------
146        sqrshrn b10, h13, #2
147        sqrshrn h15, s10, #6
148        sqrshrn s15, d12, #9
149
150// CHECK: sqrshrn b10, h13, #2  // encoding: [0xaa,0x9d,0x0e,0x5f]
151// CHECK: sqrshrn h15, s10, #6  // encoding: [0x4f,0x9d,0x1a,0x5f]
152// CHECK: sqrshrn s15, d12, #9  // encoding: [0x8f,0x9d,0x37,0x5f]
153
154//----------------------------------------------------------------------
155// Unsigned Saturating Rounded Shift Right Narrow (Immediate)
156//----------------------------------------------------------------------
157        uqrshrn b10, h12, #5
158        uqrshrn h12, s10, #14
159        uqrshrn s10, d10, #25
160
161// CHECK: uqrshrn b10, h12, #5   // encoding: [0x8a,0x9d,0x0b,0x7f]
162// CHECK: uqrshrn h12, s10, #14  // encoding: [0x4c,0x9d,0x12,0x7f]
163// CHECK: uqrshrn s10, d10, #25  // encoding: [0x4a,0x9d,0x27,0x7f]
164
165//----------------------------------------------------------------------
166// Signed Saturating Shift Right Unsigned Narrow (Immediate)
167//----------------------------------------------------------------------
168        sqshrun b15, h10, #7
169        sqshrun h20, s14, #3
170        sqshrun s10, d15, #15
171
172// CHECK: sqshrun b15, h10, #7   // encoding: [0x4f,0x85,0x09,0x7f]
173// CHECK: sqshrun h20, s14, #3   // encoding: [0xd4,0x85,0x1d,0x7f]
174// CHECK: sqshrun s10, d15, #15  // encoding: [0xea,0x85,0x31,0x7f]
175
176//----------------------------------------------------------------------
177// Signed Saturating Rounded Shift Right Unsigned Narrow (Immediate)
178//----------------------------------------------------------------------
179
180        sqrshrun b17, h10, #6
181        sqrshrun h10, s13, #15
182        sqrshrun s22, d16, #31
183
184// CHECK: sqrshrun b17, h10, #6   // encoding: [0x51,0x8d,0x0a,0x7f]
185// CHECK: sqrshrun h10, s13, #15  // encoding: [0xaa,0x8d,0x11,0x7f]
186// CHECK: sqrshrun s22, d16, #31  // encoding: [0x16,0x8e,0x21,0x7f]
187