diff --git a/llvm/lib/Target/VE/VEInstrVec.td b/llvm/lib/Target/VE/VEInstrVec.td --- a/llvm/lib/Target/VE/VEInstrVec.td +++ b/llvm/lib/Target/VE/VEInstrVec.td @@ -601,6 +601,49 @@ let cy = 0, sy = 0, vy = ?, vz = ? in defm v : RVmm; } +// Multiclass for generic iterative vector calculation +let vx = ?, hasSideEffects = 0, Uses = [VL] in +multiclass RVIbmopc, RegisterClass RC, + dag dag_in, string disEnc = ""> { + let DisableEncoding = disEnc in + def "" : RV; + let isCodeGenOnly = 1, Constraints = "$vx = $base", DisableEncoding = disEnc#"$base" in + def _v : RV; +} +multiclass RVIlmopc, RegisterClass RC, + dag dag_in> { + defm "" : RVIbm; + let isCodeGenOnly = 1, VE_VLInUse = 1 in { + defm l : RVIbm; + defm L : RVIbm; + } +} +// Generic RV multiclass for iterative operation with 2 argument. +// e.g. VFIA, VFIS, and VFIM +let VE_VLIndex = 3 in +multiclass RVI2mopc, RegisterClass VRC, + RegisterClass RC> { + let vy = ? in + defm vr : RVIlm; + let cy = 0, vy = ? in + defm vi : RVIlm; +} +// Generic RV multiclass for iterative operation with 3 argument. +// e.g. VFIAM, VFISM, VFIMA, and etc. +let VE_VLIndex = 4 in +multiclass RVI3mopc, RegisterClass VRC, + RegisterClass RC> { + let vy = ?, vz = ? in + defm vvr : RVIlm; + let cy = 0, vy = ?, vz = ? in + defm vvi : RVIlm; +} // Section 8.10.1 - VADD (Vector Add) let cx = 0, cx2 = 0 in @@ -1186,3 +1229,35 @@ // Section 8.14.9 - VRXOR (Vector Reduction Exclusive Or) defm VRXOR : RVF1m<"vrxor", 0x89, V64, VM>; + +//----------------------------------------------------------------------------- +// Section 8.15 - Vector Iterative Operation Instructions +//----------------------------------------------------------------------------- + +// Section 8.15.1 - VFIA (Vector Floating Iteration Add) +let cx = 0 in defm VFIAD : RVI2m<"vfia.d", 0xce, V64, I64>; +let cx = 1 in defm VFIAS : RVI2m<"vfia.s", 0xce, V64, F32>; + +// Section 8.15.2 - VFIS (Vector Floating Iteration Subtract) +let cx = 0 in defm VFISD : RVI2m<"vfis.d", 0xde, V64, I64>; +let cx = 1 in defm VFISS : RVI2m<"vfis.s", 0xde, V64, F32>; + +// Section 8.15.3 - VFIM (Vector Floating Iteration Multiply) +let cx = 0 in defm VFIMD : RVI2m<"vfim.d", 0xcf, V64, I64>; +let cx = 1 in defm VFIMS : RVI2m<"vfim.s", 0xcf, V64, F32>; + +// Section 8.15.4 - VFIAM (Vector Floating Iteration Add and Multiply) +let cx = 0 in defm VFIAMD : RVI3m<"vfiam.d", 0xee, V64, I64>; +let cx = 1 in defm VFIAMS : RVI3m<"vfiam.s", 0xee, V64, F32>; + +// Section 8.15.5 - VFISM (Vector Floating Iteration Subtract and Multiply) +let cx = 0 in defm VFISMD : RVI3m<"vfism.d", 0xfe, V64, I64>; +let cx = 1 in defm VFISMS : RVI3m<"vfism.s", 0xfe, V64, F32>; + +// Section 8.15.6 - VFIMA (Vector Floating Iteration Multiply and Add) +let cx = 0 in defm VFIMAD : RVI3m<"vfima.d", 0xef, V64, I64>; +let cx = 1 in defm VFIMAS : RVI3m<"vfima.s", 0xef, V64, F32>; + +// Section 8.15.7 - VFIMS (Vector Floating Iteration Multiply and Subtract) +let cx = 0 in defm VFIMSD : RVI3m<"vfims.d", 0xff, V64, I64>; +let cx = 1 in defm VFIMSS : RVI3m<"vfims.s", 0xff, V64, F32>; diff --git a/llvm/test/MC/VE/VFIA.s b/llvm/test/MC/VE/VFIA.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/VE/VFIA.s @@ -0,0 +1,20 @@ +# RUN: llvm-mc -triple=ve --show-encoding < %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST +# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \ +# RUN: | FileCheck %s --check-prefixes=CHECK-INST + +# CHECK-INST: vfia.d %v11, %v22, 12 +# CHECK-ENCODING: encoding: [0x00,0x00,0x16,0x0b,0x00,0x0c,0x00,0xce] +vfia.d %v11, %v22, 12 + +# CHECK-INST: vfia.d %vix, %vix, %s23 +# CHECK-ENCODING: encoding: [0x00,0x00,0xff,0xff,0x00,0x97,0x00,0xce] +vfia.d %vix, %vix, %s23 + +# CHECK-INST: vfia.s %v11, %vix, 63 +# CHECK-ENCODING: encoding: [0x00,0x00,0xff,0x0b,0x00,0x3f,0x80,0xce] +vfia.s %v11, %vix, 63 + +# CHECK-INST: vfia.s %vix, %v20, -64 +# CHECK-ENCODING: encoding: [0x00,0x00,0x14,0xff,0x00,0x40,0x80,0xce] +vfia.s %vix, %v20, -64 diff --git a/llvm/test/MC/VE/VFIAM.s b/llvm/test/MC/VE/VFIAM.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/VE/VFIAM.s @@ -0,0 +1,20 @@ +# RUN: llvm-mc -triple=ve --show-encoding < %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST +# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \ +# RUN: | FileCheck %s --check-prefixes=CHECK-INST + +# CHECK-INST: vfiam.d %v11, %v22, %v32, 12 +# CHECK-ENCODING: encoding: [0x00,0x20,0x16,0x0b,0x00,0x0c,0x00,0xee] +vfiam.d %v11, %v22, %v32, 12 + +# CHECK-INST: vfiam.d %vix, %vix, %vix, %s23 +# CHECK-ENCODING: encoding: [0x00,0xff,0xff,0xff,0x00,0x97,0x00,0xee] +vfiam.d %vix, %vix, %vix, %s23 + +# CHECK-INST: vfiam.s %v11, %vix, %vix, 63 +# CHECK-ENCODING: encoding: [0x00,0xff,0xff,0x0b,0x00,0x3f,0x80,0xee] +vfiam.s %v11, %vix, %vix, 63 + +# CHECK-INST: vfiam.s %vix, %v20, %v12, -64 +# CHECK-ENCODING: encoding: [0x00,0x0c,0x14,0xff,0x00,0x40,0x80,0xee] +vfiam.s %vix, %v20, %v12, -64 diff --git a/llvm/test/MC/VE/VFIM.s b/llvm/test/MC/VE/VFIM.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/VE/VFIM.s @@ -0,0 +1,20 @@ +# RUN: llvm-mc -triple=ve --show-encoding < %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST +# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \ +# RUN: | FileCheck %s --check-prefixes=CHECK-INST + +# CHECK-INST: vfim.d %v11, %v22, 12 +# CHECK-ENCODING: encoding: [0x00,0x00,0x16,0x0b,0x00,0x0c,0x00,0xcf] +vfim.d %v11, %v22, 12 + +# CHECK-INST: vfim.d %vix, %vix, %s23 +# CHECK-ENCODING: encoding: [0x00,0x00,0xff,0xff,0x00,0x97,0x00,0xcf] +vfim.d %vix, %vix, %s23 + +# CHECK-INST: vfim.s %v11, %vix, 63 +# CHECK-ENCODING: encoding: [0x00,0x00,0xff,0x0b,0x00,0x3f,0x80,0xcf] +vfim.s %v11, %vix, 63 + +# CHECK-INST: vfim.s %vix, %v20, -64 +# CHECK-ENCODING: encoding: [0x00,0x00,0x14,0xff,0x00,0x40,0x80,0xcf] +vfim.s %vix, %v20, -64 diff --git a/llvm/test/MC/VE/VFIMA.s b/llvm/test/MC/VE/VFIMA.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/VE/VFIMA.s @@ -0,0 +1,20 @@ +# RUN: llvm-mc -triple=ve --show-encoding < %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST +# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \ +# RUN: | FileCheck %s --check-prefixes=CHECK-INST + +# CHECK-INST: vfima.d %v11, %v22, %v32, 12 +# CHECK-ENCODING: encoding: [0x00,0x20,0x16,0x0b,0x00,0x0c,0x00,0xef] +vfima.d %v11, %v22, %v32, 12 + +# CHECK-INST: vfima.d %vix, %vix, %vix, %s23 +# CHECK-ENCODING: encoding: [0x00,0xff,0xff,0xff,0x00,0x97,0x00,0xef] +vfima.d %vix, %vix, %vix, %s23 + +# CHECK-INST: vfima.s %v11, %vix, %vix, 63 +# CHECK-ENCODING: encoding: [0x00,0xff,0xff,0x0b,0x00,0x3f,0x80,0xef] +vfima.s %v11, %vix, %vix, 63 + +# CHECK-INST: vfima.s %vix, %v20, %v12, -64 +# CHECK-ENCODING: encoding: [0x00,0x0c,0x14,0xff,0x00,0x40,0x80,0xef] +vfima.s %vix, %v20, %v12, -64 diff --git a/llvm/test/MC/VE/VFIMS.s b/llvm/test/MC/VE/VFIMS.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/VE/VFIMS.s @@ -0,0 +1,20 @@ +# RUN: llvm-mc -triple=ve --show-encoding < %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST +# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \ +# RUN: | FileCheck %s --check-prefixes=CHECK-INST + +# CHECK-INST: vfims.d %v11, %v22, %v32, 12 +# CHECK-ENCODING: encoding: [0x00,0x20,0x16,0x0b,0x00,0x0c,0x00,0xff] +vfims.d %v11, %v22, %v32, 12 + +# CHECK-INST: vfims.d %vix, %vix, %vix, %s23 +# CHECK-ENCODING: encoding: [0x00,0xff,0xff,0xff,0x00,0x97,0x00,0xff] +vfims.d %vix, %vix, %vix, %s23 + +# CHECK-INST: vfims.s %v11, %vix, %vix, 63 +# CHECK-ENCODING: encoding: [0x00,0xff,0xff,0x0b,0x00,0x3f,0x80,0xff] +vfims.s %v11, %vix, %vix, 63 + +# CHECK-INST: vfims.s %vix, %v20, %v12, -64 +# CHECK-ENCODING: encoding: [0x00,0x0c,0x14,0xff,0x00,0x40,0x80,0xff] +vfims.s %vix, %v20, %v12, -64 diff --git a/llvm/test/MC/VE/VFIS.s b/llvm/test/MC/VE/VFIS.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/VE/VFIS.s @@ -0,0 +1,20 @@ +# RUN: llvm-mc -triple=ve --show-encoding < %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST +# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \ +# RUN: | FileCheck %s --check-prefixes=CHECK-INST + +# CHECK-INST: vfis.d %v11, %v22, 12 +# CHECK-ENCODING: encoding: [0x00,0x00,0x16,0x0b,0x00,0x0c,0x00,0xde] +vfis.d %v11, %v22, 12 + +# CHECK-INST: vfis.d %vix, %vix, %s23 +# CHECK-ENCODING: encoding: [0x00,0x00,0xff,0xff,0x00,0x97,0x00,0xde] +vfis.d %vix, %vix, %s23 + +# CHECK-INST: vfis.s %v11, %vix, 63 +# CHECK-ENCODING: encoding: [0x00,0x00,0xff,0x0b,0x00,0x3f,0x80,0xde] +vfis.s %v11, %vix, 63 + +# CHECK-INST: vfis.s %vix, %v20, -64 +# CHECK-ENCODING: encoding: [0x00,0x00,0x14,0xff,0x00,0x40,0x80,0xde] +vfis.s %vix, %v20, -64 diff --git a/llvm/test/MC/VE/VFISM.s b/llvm/test/MC/VE/VFISM.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/VE/VFISM.s @@ -0,0 +1,20 @@ +# RUN: llvm-mc -triple=ve --show-encoding < %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST +# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \ +# RUN: | FileCheck %s --check-prefixes=CHECK-INST + +# CHECK-INST: vfism.d %v11, %v22, %v32, 12 +# CHECK-ENCODING: encoding: [0x00,0x20,0x16,0x0b,0x00,0x0c,0x00,0xfe] +vfism.d %v11, %v22, %v32, 12 + +# CHECK-INST: vfism.d %vix, %vix, %vix, %s23 +# CHECK-ENCODING: encoding: [0x00,0xff,0xff,0xff,0x00,0x97,0x00,0xfe] +vfism.d %vix, %vix, %vix, %s23 + +# CHECK-INST: vfism.s %v11, %vix, %vix, 63 +# CHECK-ENCODING: encoding: [0x00,0xff,0xff,0x0b,0x00,0x3f,0x80,0xfe] +vfism.s %v11, %vix, %vix, 63 + +# CHECK-INST: vfism.s %vix, %v20, %v12, -64 +# CHECK-ENCODING: encoding: [0x00,0x0c,0x14,0xff,0x00,0x40,0x80,0xfe] +vfism.s %vix, %v20, %v12, -64