@@ -5418,64 +5418,60 @@ def VImm7FFF: PatLeaf<(AArch64movi_msl (i32 127), (i32 264))>;
5418
5418
def VImm8000: PatLeaf<(AArch64mvni_msl (i32 127), (i32 264))>;
5419
5419
5420
5420
// trunc(umin(X, 255)) -> UQXTRN v8i8
5421
- def : Pat<(v8i8 (trunc (umin ( v8i16 V128:$Vn), (v8i16 VImmFF) ))),
5421
+ def : Pat<(v8i8 (truncusat_u ( v8i16 V128:$Vn))),
5422
5422
(UQXTNv8i8 V128:$Vn)>;
5423
5423
// trunc(umin(X, 65535)) -> UQXTRN v4i16
5424
- def : Pat<(v4i16 (trunc (umin ( v4i32 V128:$Vn), (v4i32 VImmFFFF) ))),
5424
+ def : Pat<(v4i16 (truncusat_u ( v4i32 V128:$Vn))),
5425
5425
(UQXTNv4i16 V128:$Vn)>;
5426
5426
// trunc(smin(smax(X, -128), 128)) -> SQXTRN
5427
5427
// with reversed min/max
5428
- def : Pat<(v8i8 (trunc (smin (smax (v8i16 V128:$Vn), (v8i16 VImm80)),
5429
- (v8i16 VImm7F)))),
5430
- (SQXTNv8i8 V128:$Vn)>;
5431
- def : Pat<(v8i8 (trunc (smax (smin (v8i16 V128:$Vn), (v8i16 VImm7F)),
5432
- (v8i16 VImm80)))),
5428
+ def : Pat<(v8i8 (truncssat_s (v8i16 V128:$Vn))),
5433
5429
(SQXTNv8i8 V128:$Vn)>;
5430
+ // trunc(umin(smax(X, 0), 255)) -> SQXTUN
5431
+ def : Pat<(v8i8 (truncssat_u (v8i16 V128:$Vn))),
5432
+ (SQXTUNv8i8 V128:$Vn)>;
5434
5433
// trunc(smin(smax(X, -32768), 32767)) -> SQXTRN
5435
5434
// with reversed min/max
5436
- def : Pat<(v4i16 (trunc (smin (smax (v4i32 V128:$Vn), (v4i32 VImm8000)),
5437
- (v4i32 VImm7FFF)))),
5438
- (SQXTNv4i16 V128:$Vn)>;
5439
- def : Pat<(v4i16 (trunc (smax (smin (v4i32 V128:$Vn), (v4i32 VImm7FFF)),
5440
- (v4i32 VImm8000)))),
5435
+ def : Pat<(v4i16 (truncssat_s (v4i32 V128:$Vn))),
5441
5436
(SQXTNv4i16 V128:$Vn)>;
5437
+ // trunc(umin(smax(X, 0), 65535)) -> SQXTUN
5438
+ def : Pat<(v4i16 (truncssat_u (v4i32 V128:$Vn))),
5439
+ (SQXTUNv4i16 V128:$Vn)>;
5442
5440
5443
5441
// concat_vectors(Vd, trunc(umin(X, 255))) -> UQXTRN(Vd, Vn)
5444
5442
def : Pat<(v16i8 (concat_vectors
5445
5443
(v8i8 V64:$Vd),
5446
- (v8i8 (trunc (umin ( v8i16 V128:$Vn), (v8i16 VImmFF) ))))),
5444
+ (v8i8 (truncusat_u ( v8i16 V128:$Vn))))),
5447
5445
(UQXTNv16i8 (INSERT_SUBREG (IMPLICIT_DEF), V64:$Vd, dsub), V128:$Vn)>;
5448
5446
// concat_vectors(Vd, trunc(umin(X, 65535))) -> UQXTRN(Vd, Vn)
5449
5447
def : Pat<(v8i16 (concat_vectors
5450
5448
(v4i16 V64:$Vd),
5451
- (v4i16 (trunc (umin ( v4i32 V128:$Vn), (v4i32 VImmFFFF) ))))),
5449
+ (v4i16 (truncusat_u ( v4i32 V128:$Vn))))),
5452
5450
(UQXTNv8i16 (INSERT_SUBREG (IMPLICIT_DEF), V64:$Vd, dsub), V128:$Vn)>;
5453
5451
5454
5452
// concat_vectors(Vd, trunc(smin(smax Vm, -128), 127) ~> SQXTN2(Vd, Vn)
5455
5453
// with reversed min/max
5456
5454
def : Pat<(v16i8 (concat_vectors
5457
5455
(v8i8 V64:$Vd),
5458
- (v8i8 (trunc (smin (smax (v8i16 V128:$Vn), (v8i16 VImm80)),
5459
- (v8i16 VImm7F)))))),
5456
+ (v8i8 (truncssat_s (v8i16 V128:$Vn))))),
5460
5457
(SQXTNv16i8 (INSERT_SUBREG (IMPLICIT_DEF), V64:$Vd, dsub), V128:$Vn)>;
5458
+ // concat_vectors(Vd, trunc(smin(smax Vm, 0), 127) ~> SQXTUN2(Vd, Vn)
5461
5459
def : Pat<(v16i8 (concat_vectors
5462
5460
(v8i8 V64:$Vd),
5463
- (v8i8 (trunc (smax (smin (v8i16 V128:$Vn), (v8i16 VImm7F)),
5464
- (v8i16 VImm80)))))),
5465
- (SQXTNv16i8 (INSERT_SUBREG (IMPLICIT_DEF), V64:$Vd, dsub), V128:$Vn)>;
5461
+ (v8i8 (truncssat_u (v8i16 V128:$Vn))))),
5462
+ (SQXTUNv16i8 (INSERT_SUBREG (IMPLICIT_DEF), V64:$Vd, dsub), V128:$Vn)>;
5466
5463
5467
5464
// concat_vectors(Vd, trunc(smin(smax Vm, -32768), 32767) ~> SQXTN2(Vd, Vn)
5468
5465
// with reversed min/max
5469
5466
def : Pat<(v8i16 (concat_vectors
5470
5467
(v4i16 V64:$Vd),
5471
- (v4i16 (trunc (smin (smax (v4i32 V128:$Vn), (v4i32 VImm8000)),
5472
- (v4i32 VImm7FFF)))))),
5468
+ (v4i16 (truncssat_s (v4i32 V128:$Vn))))),
5473
5469
(SQXTNv8i16 (INSERT_SUBREG (IMPLICIT_DEF), V64:$Vd, dsub), V128:$Vn)>;
5470
+ // concat_vectors(Vd, trunc(smin(smax Vm, 0), 32767) ~> SQXTUN2(Vd, Vn)
5474
5471
def : Pat<(v8i16 (concat_vectors
5475
5472
(v4i16 V64:$Vd),
5476
- (v4i16 (trunc (smax (smin (v4i32 V128:$Vn), (v4i32 VImm7FFF)),
5477
- (v4i32 VImm8000)))))),
5478
- (SQXTNv8i16 (INSERT_SUBREG (IMPLICIT_DEF), V64:$Vd, dsub), V128:$Vn)>;
5473
+ (v4i16 (truncssat_u (v4i32 V128:$Vn))))),
5474
+ (SQXTUNv8i16 (INSERT_SUBREG (IMPLICIT_DEF), V64:$Vd, dsub), V128:$Vn)>;
5479
5475
5480
5476
// Select BSWAP vector instructions into REV instructions
5481
5477
def : Pat<(v4i16 (bswap (v4i16 V64:$Rn))),
0 commit comments