@@ -1059,6 +1059,19 @@ define <vscale x 16 x i8> @sqadd_b_lowimm(<vscale x 16 x i8> %a) {
1059
1059
ret <vscale x 16 x i8 > %out
1060
1060
}
1061
1061
1062
+ ; Immediate instruction form only supports positive values.
1063
+ define <vscale x 16 x i8 > @sqadd_b_negimm (<vscale x 16 x i8 > %a ) {
1064
+ ; CHECK-LABEL: sqadd_b_negimm:
1065
+ ; CHECK: // %bb.0:
1066
+ ; CHECK-NEXT: sqsub z0.b, z0.b, #128 // =0x80
1067
+ ; CHECK-NEXT: ret
1068
+ %elt = insertelement <vscale x 16 x i8 > undef , i8 -128 , i32 0
1069
+ %splat = shufflevector <vscale x 16 x i8 > %elt , <vscale x 16 x i8 > undef , <vscale x 16 x i32 > zeroinitializer
1070
+ %out = call <vscale x 16 x i8 > @llvm.aarch64.sve.sqadd.x.nxv16i8 (<vscale x 16 x i8 > %a ,
1071
+ <vscale x 16 x i8 > %splat )
1072
+ ret <vscale x 16 x i8 > %out
1073
+ }
1074
+
1062
1075
define <vscale x 8 x i16 > @sqadd_h_lowimm (<vscale x 8 x i16 > %a ) {
1063
1076
; CHECK-LABEL: sqadd_h_lowimm:
1064
1077
; CHECK: // %bb.0:
@@ -1083,6 +1096,19 @@ define <vscale x 8 x i16> @sqadd_h_highimm(<vscale x 8 x i16> %a) {
1083
1096
ret <vscale x 8 x i16 > %out
1084
1097
}
1085
1098
1099
+ ; Immediate instruction form only supports positive values.
1100
+ define <vscale x 8 x i16 > @sqadd_h_negimm (<vscale x 8 x i16 > %a ) {
1101
+ ; CHECK-LABEL: sqadd_h_negimm:
1102
+ ; CHECK: // %bb.0:
1103
+ ; CHECK-NEXT: sqsub z0.h, z0.h, #1 // =0x1
1104
+ ; CHECK-NEXT: ret
1105
+ %elt = insertelement <vscale x 8 x i16 > undef , i16 -1 , i32 0
1106
+ %splat = shufflevector <vscale x 8 x i16 > %elt , <vscale x 8 x i16 > undef , <vscale x 8 x i32 > zeroinitializer
1107
+ %out = call <vscale x 8 x i16 > @llvm.aarch64.sve.sqadd.x.nxv8i16 (<vscale x 8 x i16 > %a ,
1108
+ <vscale x 8 x i16 > %splat )
1109
+ ret <vscale x 8 x i16 > %out
1110
+ }
1111
+
1086
1112
define <vscale x 4 x i32 > @sqadd_s_lowimm (<vscale x 4 x i32 > %a ) {
1087
1113
; CHECK-LABEL: sqadd_s_lowimm:
1088
1114
; CHECK: // %bb.0:
@@ -1107,6 +1133,19 @@ define <vscale x 4 x i32> @sqadd_s_highimm(<vscale x 4 x i32> %a) {
1107
1133
ret <vscale x 4 x i32 > %out
1108
1134
}
1109
1135
1136
+ ; Immediate instruction form only supports positive values.
1137
+ define <vscale x 4 x i32 > @sqadd_s_negimm (<vscale x 4 x i32 > %a ) {
1138
+ ; CHECK-LABEL: sqadd_s_negimm:
1139
+ ; CHECK: // %bb.0:
1140
+ ; CHECK-NEXT: sqsub z0.s, z0.s, #65280 // =0xff00
1141
+ ; CHECK-NEXT: ret
1142
+ %elt = insertelement <vscale x 4 x i32 > undef , i32 -65280 , i32 0
1143
+ %splat = shufflevector <vscale x 4 x i32 > %elt , <vscale x 4 x i32 > undef , <vscale x 4 x i32 > zeroinitializer
1144
+ %out = call <vscale x 4 x i32 > @llvm.aarch64.sve.sqadd.x.nxv4i32 (<vscale x 4 x i32 > %a ,
1145
+ <vscale x 4 x i32 > %splat )
1146
+ ret <vscale x 4 x i32 > %out
1147
+ }
1148
+
1110
1149
define <vscale x 2 x i64 > @sqadd_d_lowimm (<vscale x 2 x i64 > %a ) {
1111
1150
; CHECK-LABEL: sqadd_d_lowimm:
1112
1151
; CHECK: // %bb.0:
@@ -1131,6 +1170,19 @@ define <vscale x 2 x i64> @sqadd_d_highimm(<vscale x 2 x i64> %a) {
1131
1170
ret <vscale x 2 x i64 > %out
1132
1171
}
1133
1172
1173
+ ; Immediate instruction form only supports positive values.
1174
+ define <vscale x 2 x i64 > @sqadd_d_negimm (<vscale x 2 x i64 > %a ) {
1175
+ ; CHECK-LABEL: sqadd_d_negimm:
1176
+ ; CHECK: // %bb.0:
1177
+ ; CHECK-NEXT: sqsub z0.d, z0.d, #3840 // =0xf00
1178
+ ; CHECK-NEXT: ret
1179
+ %elt = insertelement <vscale x 2 x i64 > undef , i64 -3840 , i32 0
1180
+ %splat = shufflevector <vscale x 2 x i64 > %elt , <vscale x 2 x i64 > undef , <vscale x 2 x i32 > zeroinitializer
1181
+ %out = call <vscale x 2 x i64 > @llvm.aarch64.sve.sqadd.x.nxv2i64 (<vscale x 2 x i64 > %a ,
1182
+ <vscale x 2 x i64 > %splat )
1183
+ ret <vscale x 2 x i64 > %out
1184
+ }
1185
+
1134
1186
; SQSUB
1135
1187
1136
1188
define <vscale x 16 x i8 > @sqsub_b_lowimm (<vscale x 16 x i8 > %a ) {
@@ -1145,6 +1197,19 @@ define <vscale x 16 x i8> @sqsub_b_lowimm(<vscale x 16 x i8> %a) {
1145
1197
ret <vscale x 16 x i8 > %out
1146
1198
}
1147
1199
1200
+ ; Immediate instruction form only supports positive values.
1201
+ define <vscale x 16 x i8 > @sqsub_b_negimm (<vscale x 16 x i8 > %a ) {
1202
+ ; CHECK-LABEL: sqsub_b_negimm:
1203
+ ; CHECK: // %bb.0:
1204
+ ; CHECK-NEXT: sqadd z0.b, z0.b, #1 // =0x1
1205
+ ; CHECK-NEXT: ret
1206
+ %elt = insertelement <vscale x 16 x i8 > undef , i8 -1 , i32 0
1207
+ %splat = shufflevector <vscale x 16 x i8 > %elt , <vscale x 16 x i8 > undef , <vscale x 16 x i32 > zeroinitializer
1208
+ %out = call <vscale x 16 x i8 > @llvm.aarch64.sve.sqsub.x.nxv16i8 (<vscale x 16 x i8 > %a ,
1209
+ <vscale x 16 x i8 > %splat )
1210
+ ret <vscale x 16 x i8 > %out
1211
+ }
1212
+
1148
1213
define <vscale x 8 x i16 > @sqsub_h_lowimm (<vscale x 8 x i16 > %a ) {
1149
1214
; CHECK-LABEL: sqsub_h_lowimm:
1150
1215
; CHECK: // %bb.0:
@@ -1169,6 +1234,19 @@ define <vscale x 8 x i16> @sqsub_h_highimm(<vscale x 8 x i16> %a) {
1169
1234
ret <vscale x 8 x i16 > %out
1170
1235
}
1171
1236
1237
+ ; Immediate instruction form only supports positive values.
1238
+ define <vscale x 8 x i16 > @sqsub_h_negimm (<vscale x 8 x i16 > %a ) {
1239
+ ; CHECK-LABEL: sqsub_h_negimm:
1240
+ ; CHECK: // %bb.0:
1241
+ ; CHECK-NEXT: sqadd z0.h, z0.h, #128 // =0x80
1242
+ ; CHECK-NEXT: ret
1243
+ %elt = insertelement <vscale x 8 x i16 > undef , i16 -128 , i32 0
1244
+ %splat = shufflevector <vscale x 8 x i16 > %elt , <vscale x 8 x i16 > undef , <vscale x 8 x i32 > zeroinitializer
1245
+ %out = call <vscale x 8 x i16 > @llvm.aarch64.sve.sqsub.x.nxv8i16 (<vscale x 8 x i16 > %a ,
1246
+ <vscale x 8 x i16 > %splat )
1247
+ ret <vscale x 8 x i16 > %out
1248
+ }
1249
+
1172
1250
define <vscale x 4 x i32 > @sqsub_s_lowimm (<vscale x 4 x i32 > %a ) {
1173
1251
; CHECK-LABEL: sqsub_s_lowimm:
1174
1252
; CHECK: // %bb.0:
@@ -1193,6 +1271,19 @@ define <vscale x 4 x i32> @sqsub_s_highimm(<vscale x 4 x i32> %a) {
1193
1271
ret <vscale x 4 x i32 > %out
1194
1272
}
1195
1273
1274
+ ; Immediate instruction form only supports positive values.
1275
+ define <vscale x 4 x i32 > @sqsub_s_negimm (<vscale x 4 x i32 > %a ) {
1276
+ ; CHECK-LABEL: sqsub_s_negimm:
1277
+ ; CHECK: // %bb.0:
1278
+ ; CHECK-NEXT: sqadd z0.s, z0.s, #32768 // =0x8000
1279
+ ; CHECK-NEXT: ret
1280
+ %elt = insertelement <vscale x 4 x i32 > undef , i32 -32768 , i32 0
1281
+ %splat = shufflevector <vscale x 4 x i32 > %elt , <vscale x 4 x i32 > undef , <vscale x 4 x i32 > zeroinitializer
1282
+ %out = call <vscale x 4 x i32 > @llvm.aarch64.sve.sqsub.x.nxv4i32 (<vscale x 4 x i32 > %a ,
1283
+ <vscale x 4 x i32 > %splat )
1284
+ ret <vscale x 4 x i32 > %out
1285
+ }
1286
+
1196
1287
define <vscale x 2 x i64 > @sqsub_d_lowimm (<vscale x 2 x i64 > %a ) {
1197
1288
; CHECK-LABEL: sqsub_d_lowimm:
1198
1289
; CHECK: // %bb.0:
@@ -1217,6 +1308,19 @@ define <vscale x 2 x i64> @sqsub_d_highimm(<vscale x 2 x i64> %a) {
1217
1308
ret <vscale x 2 x i64 > %out
1218
1309
}
1219
1310
1311
+ ; Immediate instruction form only supports positive values.
1312
+ define <vscale x 2 x i64 > @sqsub_d_negimm (<vscale x 2 x i64 > %a ) {
1313
+ ; CHECK-LABEL: sqsub_d_negimm:
1314
+ ; CHECK: // %bb.0:
1315
+ ; CHECK-NEXT: sqadd z0.d, z0.d, #57344 // =0xe000
1316
+ ; CHECK-NEXT: ret
1317
+ %elt = insertelement <vscale x 2 x i64 > undef , i64 -57344 , i32 0
1318
+ %splat = shufflevector <vscale x 2 x i64 > %elt , <vscale x 2 x i64 > undef , <vscale x 2 x i32 > zeroinitializer
1319
+ %out = call <vscale x 2 x i64 > @llvm.aarch64.sve.sqsub.x.nxv2i64 (<vscale x 2 x i64 > %a ,
1320
+ <vscale x 2 x i64 > %splat )
1321
+ ret <vscale x 2 x i64 > %out
1322
+ }
1323
+
1220
1324
; UQADD
1221
1325
1222
1326
define <vscale x 16 x i8 > @uqadd_b_lowimm (<vscale x 16 x i8 > %a ) {
0 commit comments