diff --git a/llvm/lib/Target/AArch64/AArch64InstrFormats.td b/llvm/lib/Target/AArch64/AArch64InstrFormats.td --- a/llvm/lib/Target/AArch64/AArch64InstrFormats.td +++ b/llvm/lib/Target/AArch64/AArch64InstrFormats.td @@ -6826,16 +6826,19 @@ } multiclass SIMDFPThreeScalar opc, string asm, - SDPatternOperator OpNode = null_frag> { + SDPatternOperator OpNode = null_frag, + Predicate pred = HasNEON> { let mayLoad = 0, mayStore = 0, hasSideEffects = 0 in { + let Predicates = [pred] in { def NAME#64 : BaseSIMDThreeScalar; def NAME#32 : BaseSIMDThreeScalar; - let Predicates = [HasNEON, HasFullFP16] in { + } + let Predicates = [pred, HasFullFP16] in { def NAME#16 : BaseSIMDThreeScalar; - } // Predicates = [HasNEON, HasFullFP16] + } } def : Pat<(v1f64 (OpNode (v1f64 FPR64:$Rn), (v1f64 FPR64:$Rm))), @@ -7025,10 +7028,13 @@ (!cast(NAME # "v1i64") FPR64:$Rn)>; } -multiclass SIMDFPTwoScalar opc, string asm> { +multiclass SIMDFPTwoScalar opc, string asm, + Predicate pred = HasNEON> { + let Predicates = [pred] in { def v1i64 : BaseSIMDTwoScalar; def v1i32 : BaseSIMDTwoScalar; - let Predicates = [HasNEON, HasFullFP16] in { + } + let Predicates = [pred, HasFullFP16] in { def v1f16 : BaseSIMDTwoScalar; } } diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.td b/llvm/lib/Target/AArch64/AArch64InstrInfo.td --- a/llvm/lib/Target/AArch64/AArch64InstrInfo.td +++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.td @@ -4624,9 +4624,9 @@ defm FCMEQ : SIMDThreeScalarFPCmp<0, 0, 0b100, "fcmeq", AArch64fcmeq>; defm FCMGE : SIMDThreeScalarFPCmp<1, 0, 0b100, "fcmge", AArch64fcmge>; defm FCMGT : SIMDThreeScalarFPCmp<1, 1, 0b100, "fcmgt", AArch64fcmgt>; -defm FMULX : SIMDFPThreeScalar<0, 0, 0b011, "fmulx", int_aarch64_neon_fmulx>; -defm FRECPS : SIMDFPThreeScalar<0, 0, 0b111, "frecps", int_aarch64_neon_frecps>; -defm FRSQRTS : SIMDFPThreeScalar<0, 1, 0b111, "frsqrts", int_aarch64_neon_frsqrts>; +defm FMULX : SIMDFPThreeScalar<0, 0, 0b011, "fmulx", int_aarch64_neon_fmulx, HasNEONorStreamingSVE>; +defm FRECPS : SIMDFPThreeScalar<0, 0, 0b111, "frecps", int_aarch64_neon_frecps, HasNEONorStreamingSVE>; +defm FRSQRTS : SIMDFPThreeScalar<0, 1, 0b111, "frsqrts", int_aarch64_neon_frsqrts, HasNEONorStreamingSVE>; defm SQADD : SIMDThreeScalarBHSD<0, 0b00001, "sqadd", int_aarch64_neon_sqadd>; defm SQDMULH : SIMDThreeScalarHS< 0, 0b10110, "sqdmulh", int_aarch64_neon_sqdmulh>; defm SQRDMULH : SIMDThreeScalarHS< 1, 0b10110, "sqrdmulh", int_aarch64_neon_sqrdmulh>; @@ -4725,9 +4725,9 @@ def FCVTXNv1i64 : SIMDInexactCvtTwoScalar<0b10110, "fcvtxn">; defm FCVTZS : SIMDFPTwoScalar< 0, 1, 0b11011, "fcvtzs">; defm FCVTZU : SIMDFPTwoScalar< 1, 1, 0b11011, "fcvtzu">; -defm FRECPE : SIMDFPTwoScalar< 0, 1, 0b11101, "frecpe">; -defm FRECPX : SIMDFPTwoScalar< 0, 1, 0b11111, "frecpx">; -defm FRSQRTE : SIMDFPTwoScalar< 1, 1, 0b11101, "frsqrte">; +defm FRECPE : SIMDFPTwoScalar< 0, 1, 0b11101, "frecpe", HasNEONorStreamingSVE>; +defm FRECPX : SIMDFPTwoScalar< 0, 1, 0b11111, "frecpx", HasNEONorStreamingSVE>; +defm FRSQRTE : SIMDFPTwoScalar< 1, 1, 0b11101, "frsqrte", HasNEONorStreamingSVE>; defm NEG : SIMDTwoScalarD< 1, 0b01011, "neg", UnOpFrag<(sub immAllZerosV, node:$LHS)> >; defm SCVTF : SIMDFPTwoScalarCVT< 0, 0, 0b11101, "scvtf", AArch64sitof>; diff --git a/llvm/test/MC/AArch64/SME/streaming-mode-neon-fp16.s b/llvm/test/MC/AArch64/SME/streaming-mode-neon-fp16.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/AArch64/SME/streaming-mode-neon-fp16.s @@ -0,0 +1,43 @@ +// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+streaming-sve,+fullfp16 < %s \ +// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST +// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=-neon < %s 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-ERROR +// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+streaming-sve,+fullfp16 < %s \ +// RUN: | llvm-objdump --mattr=+fullfp16 -d - | FileCheck %s --check-prefix=CHECK-INST +// Disassemble encoding and check the re-encoding (-show-encoding) matches. +// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+streaming-sve,+fullfp16 < %s \ +// RUN: | sed '/.text/d' | sed 's/.*encoding: //g' \ +// RUN: | llvm-mc -triple=aarch64 -mattr=+streaming-sve,+fullfp16 -disassemble -show-encoding \ +// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST + +// Scalar FP instructions + +fmulx h0, h1, h2 +// CHECK-INST: fmulx h0, h1, h2 +// CHECK-ENCODING: [0x20,0x1c,0x42,0x5e] +// CHECK-ERROR: instruction requires: fullfp16 + +frecps h0, h1, h2 +// CHECK-INST: frecps h0, h1, h2 +// CHECK-ENCODING: [0x20,0x3c,0x42,0x5e] +// CHECK-ERROR: instruction requires: fullfp16 + +frsqrts h0, h1, h2 +// CHECK-INST: frsqrts h0, h1, h2 +// CHECK-ENCODING: [0x20,0x3c,0xc2,0x5e] +// CHECK-ERROR: instruction requires: fullfp16 + +frecpe h0, h1 +// CHECK-INST: frecpe h0, h1 +// CHECK-ENCODING: [0x20,0xd8,0xf9,0x5e] +// CHECK-ERROR: instruction requires: fullfp16 + +frecpx h0, h1 +// CHECK-INST: frecpx h0, h1 +// CHECK-ENCODING: [0x20,0xf8,0xf9,0x5e] +// CHECK-ERROR: instruction requires: fullfp16 + +frsqrte h0, h1 +// CHECK-INST: frsqrte h0, h1 +// CHECK-ENCODING: [0x20,0xd8,0xf9,0x7e] +// CHECK-ERROR: instruction requires: fullfp16 diff --git a/llvm/test/MC/AArch64/SME/streaming-mode-neon-negative.s b/llvm/test/MC/AArch64/SME/streaming-mode-neon-negative.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/AArch64/SME/streaming-mode-neon-negative.s @@ -0,0 +1,9 @@ +// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+streaming-sve 2>&1 < %s| FileCheck %s + +// ------------------------------------------------------------------------- // +// Check FABD is illegal in streaming mode + +fabd s0, s1, s2 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction requires: neon +// CHECK-NEXT: fabd s0, s1, s2 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: diff --git a/llvm/test/MC/AArch64/SME/streaming-mode-neon.s b/llvm/test/MC/AArch64/SME/streaming-mode-neon.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/AArch64/SME/streaming-mode-neon.s @@ -0,0 +1,73 @@ +// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+streaming-sve < %s \ +// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST +// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=-neon < %s 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-ERROR +// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+streaming-sve < %s \ +// RUN: | llvm-objdump -d - | FileCheck %s --check-prefix=CHECK-INST +// Disassemble encoding and check the re-encoding (-show-encoding) matches. +// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+streaming-sve < %s \ +// RUN: | sed '/.text/d' | sed 's/.*encoding: //g' \ +// RUN: | llvm-mc -triple=aarch64 -mattr=+streaming-sve -disassemble -show-encoding \ +// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST + +// Scalar FP instructions + +fmulx s0, s1, s2 +// CHECK-INST: fmulx s0, s1, s2 +// CHECK-ENCODING: [0x20,0xdc,0x22,0x5e] +// CHECK-ERROR: instruction requires: streaming-sve or neon + +fmulx d0, d1, d2 +// CHECK-INST: fmulx d0, d1, d2 +// CHECK-ENCODING: [0x20,0xdc,0x62,0x5e] +// CHECK-ERROR: instruction requires: streaming-sve or neon + +frecps s0, s1, s2 +// CHECK-INST: frecps s0, s1, s2 +// CHECK-ENCODING: [0x20,0xfc,0x22,0x5e] +// CHECK-ERROR: instruction requires: streaming-sve or neon + +frecps d0, d1, d2 +// CHECK-INST: frecps d0, d1, d2 +// CHECK-ENCODING: [0x20,0xfc,0x62,0x5e] +// CHECK-ERROR: instruction requires: streaming-sve or neon + +frsqrts s0, s1, s2 +// CHECK-INST: frsqrts s0, s1, s2 +// CHECK-ENCODING: [0x20,0xfc,0xa2,0x5e] +// CHECK-ERROR: instruction requires: streaming-sve or neon + +frsqrts d0, d1, d2 +// CHECK-INST: frsqrts d0, d1, d2 +// CHECK-ENCODING: [0x20,0xfc,0xe2,0x5e] +// CHECK-ERROR: instruction requires: streaming-sve or neon + +frecpe s0, s1 +// CHECK-INST: frecpe s0, s1 +// CHECK-ENCODING: [0x20,0xd8,0xa1,0x5e] +// CHECK-ERROR: instruction requires: streaming-sve or neon + +frecpe d0, d1 +// CHECK-INST: frecpe d0, d1 +// CHECK-ENCODING: [0x20,0xd8,0xe1,0x5e] +// CHECK-ERROR: instruction requires: streaming-sve or neon + +frecpx s0, s1 +// CHECK-INST: frecpx s0, s1 +// CHECK-ENCODING: [0x20,0xf8,0xa1,0x5e] +// CHECK-ERROR: instruction requires: streaming-sve or neon + +frecpx d0, d1 +// CHECK-INST: frecpx d0, d1 +// CHECK-ENCODING: [0x20,0xf8,0xe1,0x5e] +// CHECK-ERROR: instruction requires: streaming-sve or neon + +frsqrte s0, s1 +// CHECK-INST: frsqrte s0, s1 +// CHECK-ENCODING: [0x20,0xd8,0xa1,0x7e] +// CHECK-ERROR: instruction requires: streaming-sve or neon + +frsqrte d0, d1 +// CHECK-INST: frsqrte d0, d1 +// CHECK-ENCODING: [0x20,0xd8,0xe1,0x7e] +// CHECK-ERROR: instruction requires: streaming-sve or neon