From d17728f4fd670253cafdbcca6b5c5ebd08ea8bfd Mon Sep 17 00:00:00 2001 From: Pavel Iliin Date: Thu, 23 Apr 2020 22:03:42 +0100 Subject: [PATCH] [AArch64][FIX] FPR16_lo for f16 indexed patterns. --- lib/Target/AArch64/AArch64InstrFormats.td | 8 ++++---- lib/Target/AArch64/AArch64RegisterBankInfo.cpp | 2 ++ lib/Target/AArch64/AArch64RegisterInfo.cpp | 1 + lib/Target/AArch64/AArch64RegisterInfo.td | 11 +++++++++-- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/lib/Target/AArch64/AArch64InstrFormats.td b/lib/Target/AArch64/AArch64InstrFormats.td index 13f086ff1f5..1743b0c68eb 100644 --- a/lib/Target/AArch64/AArch64InstrFormats.td +++ b/lib/Target/AArch64/AArch64InstrFormats.td @@ -8073,9 +8073,9 @@ multiclass SIMDFPIndexedTiedPatterns { (!cast(INST # "v8i16_indexed") V128:$Rd, V128:$Rn, V128_lo:$Rm, VectorIndexH:$idx)>; def : Pat<(v8f16 (OpNode (v8f16 V128:$Rd), (v8f16 V128:$Rn), - (AArch64dup (f16 FPR16Op:$Rm)))), + (AArch64dup (f16 FPR16Op_lo:$Rm)))), (!cast(INST # "v8i16_indexed") V128:$Rd, V128:$Rn, - (SUBREG_TO_REG (i32 0), FPR16Op:$Rm, hsub), (i64 0))>; + (SUBREG_TO_REG (i32 0), FPR16Op_lo:$Rm, hsub), (i64 0))>; def : Pat<(v4f16 (OpNode (v4f16 V64:$Rd), (v4f16 V64:$Rn), (AArch64duplane16 (v8f16 V128_lo:$Rm), @@ -8083,9 +8083,9 @@ multiclass SIMDFPIndexedTiedPatterns { (!cast(INST # "v4i16_indexed") V64:$Rd, V64:$Rn, V128_lo:$Rm, VectorIndexH:$idx)>; def : Pat<(v4f16 (OpNode (v4f16 V64:$Rd), (v4f16 V64:$Rn), - (AArch64dup (f16 FPR16Op:$Rm)))), + (AArch64dup (f16 FPR16Op_lo:$Rm)))), (!cast(INST # "v4i16_indexed") V64:$Rd, V64:$Rn, - (SUBREG_TO_REG (i32 0), FPR16Op:$Rm, hsub), (i64 0))>; + (SUBREG_TO_REG (i32 0), FPR16Op_lo:$Rm, hsub), (i64 0))>; def : Pat<(f16 (OpNode (f16 FPR16:$Rd), (f16 FPR16:$Rn), (vector_extract (v8f16 V128_lo:$Rm), VectorIndexH:$idx))), diff --git a/lib/Target/AArch64/AArch64RegisterBankInfo.cpp b/lib/Target/AArch64/AArch64RegisterBankInfo.cpp index e671ff21621..77998650043 100644 --- a/lib/Target/AArch64/AArch64RegisterBankInfo.cpp +++ b/lib/Target/AArch64/AArch64RegisterBankInfo.cpp @@ -231,6 +231,8 @@ AArch64RegisterBankInfo::getRegBankFromRegClass(const TargetRegisterClass &RC, switch (RC.getID()) { case AArch64::FPR8RegClassID: case AArch64::FPR16RegClassID: + case AArch64::FPR16_loRegClassID: + case AArch64::FPR32_with_hsub_in_FPR16_loRegClassID: case AArch64::FPR32RegClassID: case AArch64::FPR64RegClassID: case AArch64::FPR64_loRegClassID: diff --git a/lib/Target/AArch64/AArch64RegisterInfo.cpp b/lib/Target/AArch64/AArch64RegisterInfo.cpp index c8556c21195..6c49542e4ff 100644 --- a/lib/Target/AArch64/AArch64RegisterInfo.cpp +++ b/lib/Target/AArch64/AArch64RegisterInfo.cpp @@ -597,6 +597,7 @@ unsigned AArch64RegisterInfo::getRegPressureLimit(const TargetRegisterClass *RC, case AArch64::FPR128_loRegClassID: case AArch64::FPR64_loRegClassID: + case AArch64::FPR16_loRegClassID: return 16; } } diff --git a/lib/Target/AArch64/AArch64RegisterInfo.td b/lib/Target/AArch64/AArch64RegisterInfo.td index 4cd01234a6b..93b6aa0cdb7 100644 --- a/lib/Target/AArch64/AArch64RegisterInfo.td +++ b/lib/Target/AArch64/AArch64RegisterInfo.td @@ -425,6 +425,9 @@ def FPR8 : RegisterClass<"AArch64", [untyped], 8, (sequence "B%u", 0, 31)> { def FPR16 : RegisterClass<"AArch64", [f16], 16, (sequence "H%u", 0, 31)> { let Size = 16; } +def FPR16_lo : RegisterClass<"AArch64", [f16], 16, (trunc FPR16, 16)> { + let Size = 16; +} def FPR32 : RegisterClass<"AArch64", [f32, i32], 32,(sequence "S%u", 0, 31)>; def FPR64 : RegisterClass<"AArch64", [f64, i64, v2f32, v1f64, v8i8, v4i16, v2i32, v1i64, v4f16], @@ -648,6 +651,10 @@ def FPR16Op : RegisterOperand { let ParserMatchClass = FPRAsmOperand<"FPR16">; } +def FPR16Op_lo : RegisterOperand { + let ParserMatchClass = FPRAsmOperand<"FPR16_lo">; +} + def FPR32Op : RegisterOperand { let ParserMatchClass = FPRAsmOperand<"FPR32">; } @@ -671,11 +678,11 @@ def XSeqPairs : RegisterTuples<[sube64, subo64], [(decimate (rotl GPR64, 0), 2), (decimate (rotl GPR64, 1), 2)]>; -def WSeqPairsClass : RegisterClass<"AArch64", [untyped], 32, +def WSeqPairsClass : RegisterClass<"AArch64", [untyped], 32, (add WSeqPairs)>{ let Size = 64; } -def XSeqPairsClass : RegisterClass<"AArch64", [untyped], 64, +def XSeqPairsClass : RegisterClass<"AArch64", [untyped], 64, (add XSeqPairs)>{ let Size = 128; }