1a8b04e1cSUlrich Weigand//==- SystemZInstrVector.td - SystemZ Vector instructions ------*- tblgen-*-==// 2a8b04e1cSUlrich Weigand// 32946cd70SChandler Carruth// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 42946cd70SChandler Carruth// See https://llvm.org/LICENSE.txt for license information. 52946cd70SChandler Carruth// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6a8b04e1cSUlrich Weigand// 7a8b04e1cSUlrich Weigand//===----------------------------------------------------------------------===// 8a8b04e1cSUlrich Weigand 9a8b04e1cSUlrich Weigand//===----------------------------------------------------------------------===// 10a8b04e1cSUlrich Weigand// Move instructions 11a8b04e1cSUlrich Weigand//===----------------------------------------------------------------------===// 12a8b04e1cSUlrich Weigand 13a8b04e1cSUlrich Weigandlet Predicates = [FeatureVector] in { 14a8b04e1cSUlrich Weigand // Register move. 15a8b04e1cSUlrich Weigand def VLR : UnaryVRRa<"vlr", 0xE756, null_frag, v128any, v128any>; 1633435c4cSUlrich Weigand def VLR32 : UnaryAliasVRR<null_frag, v32sb, v32sb>; 1749506d78SUlrich Weigand def VLR64 : UnaryAliasVRR<null_frag, v64db, v64db>; 18a8b04e1cSUlrich Weigand 19a8b04e1cSUlrich Weigand // Load GR from VR element. 206e31ab38SUlrich Weigand def VLGV : BinaryVRScGeneric<"vlgv", 0xE721>; 21a8b04e1cSUlrich Weigand def VLGVB : BinaryVRSc<"vlgvb", 0xE721, null_frag, v128b, 0>; 22a8b04e1cSUlrich Weigand def VLGVH : BinaryVRSc<"vlgvh", 0xE721, null_frag, v128h, 1>; 23a8b04e1cSUlrich Weigand def VLGVF : BinaryVRSc<"vlgvf", 0xE721, null_frag, v128f, 2>; 24ce4c1095SUlrich Weigand def VLGVG : BinaryVRSc<"vlgvg", 0xE721, z_vector_extract, v128g, 3>; 25a8b04e1cSUlrich Weigand 26a8b04e1cSUlrich Weigand // Load VR element from GR. 276e31ab38SUlrich Weigand def VLVG : TernaryVRSbGeneric<"vlvg", 0xE722>; 28ce4c1095SUlrich Weigand def VLVGB : TernaryVRSb<"vlvgb", 0xE722, z_vector_insert, 29ce4c1095SUlrich Weigand v128b, v128b, GR32, 0>; 30ce4c1095SUlrich Weigand def VLVGH : TernaryVRSb<"vlvgh", 0xE722, z_vector_insert, 31ce4c1095SUlrich Weigand v128h, v128h, GR32, 1>; 32ce4c1095SUlrich Weigand def VLVGF : TernaryVRSb<"vlvgf", 0xE722, z_vector_insert, 33ce4c1095SUlrich Weigand v128f, v128f, GR32, 2>; 34ce4c1095SUlrich Weigand def VLVGG : TernaryVRSb<"vlvgg", 0xE722, z_vector_insert, 35ce4c1095SUlrich Weigand v128g, v128g, GR64, 3>; 36a8b04e1cSUlrich Weigand 37a8b04e1cSUlrich Weigand // Load VR from GRs disjoint. 38ce4c1095SUlrich Weigand def VLVGP : BinaryVRRf<"vlvgp", 0xE762, z_join_dwords, v128g>; 39ce4c1095SUlrich Weigand def VLVGP32 : BinaryAliasVRRf<GR32>; 40a8b04e1cSUlrich Weigand} 41a8b04e1cSUlrich Weigand 42ce4c1095SUlrich Weigand// Extractions always assign to the full GR64, even if the element would 43ce4c1095SUlrich Weigand// fit in the lower 32 bits. Sub-i64 extracts therefore need to take a 44ce4c1095SUlrich Weigand// subreg of the result. 45ce4c1095SUlrich Weigandclass VectorExtractSubreg<ValueType type, Instruction insn> 46ce4c1095SUlrich Weigand : Pat<(i32 (z_vector_extract (type VR128:$vec), shift12only:$index)), 47ce4c1095SUlrich Weigand (EXTRACT_SUBREG (insn VR128:$vec, shift12only:$index), subreg_l32)>; 48ce4c1095SUlrich Weigand 49ce4c1095SUlrich Weiganddef : VectorExtractSubreg<v16i8, VLGVB>; 50ce4c1095SUlrich Weiganddef : VectorExtractSubreg<v8i16, VLGVH>; 51ce4c1095SUlrich Weiganddef : VectorExtractSubreg<v4i32, VLGVF>; 52ce4c1095SUlrich Weigand 53a8b04e1cSUlrich Weigand//===----------------------------------------------------------------------===// 54a8b04e1cSUlrich Weigand// Immediate instructions 55a8b04e1cSUlrich Weigand//===----------------------------------------------------------------------===// 56a8b04e1cSUlrich Weigand 57a8b04e1cSUlrich Weigandlet Predicates = [FeatureVector] in { 58b5b91cd4SJonas Paulsson let isAsCheapAsAMove = 1, isMoveImm = 1, isReMaterializable = 1 in { 59d034e7ddSJonas Paulsson 60a8b04e1cSUlrich Weigand // Generate byte mask. 61a8b04e1cSUlrich Weigand def VZERO : InherentVRIa<"vzero", 0xE744, 0>; 62a8b04e1cSUlrich Weigand def VONE : InherentVRIa<"vone", 0xE744, 0xffff>; 633ecab8e4SMatt Arsenault def VGBM : UnaryVRIa<"vgbm", 0xE744, z_byte_mask, v128b, imm32zx16_timm>; 64a8b04e1cSUlrich Weigand 65a8b04e1cSUlrich Weigand // Generate mask. 666e31ab38SUlrich Weigand def VGM : BinaryVRIbGeneric<"vgm", 0xE746>; 67ce4c1095SUlrich Weigand def VGMB : BinaryVRIb<"vgmb", 0xE746, z_rotate_mask, v128b, 0>; 68ce4c1095SUlrich Weigand def VGMH : BinaryVRIb<"vgmh", 0xE746, z_rotate_mask, v128h, 1>; 69ce4c1095SUlrich Weigand def VGMF : BinaryVRIb<"vgmf", 0xE746, z_rotate_mask, v128f, 2>; 70ce4c1095SUlrich Weigand def VGMG : BinaryVRIb<"vgmg", 0xE746, z_rotate_mask, v128g, 3>; 71a8b04e1cSUlrich Weigand 72d034e7ddSJonas Paulsson // Replicate immediate. 73d034e7ddSJonas Paulsson def VREPI : UnaryVRIaGeneric<"vrepi", 0xE745, imm32sx16>; 743ecab8e4SMatt Arsenault def VREPIB : UnaryVRIa<"vrepib", 0xE745, z_replicate, v128b, imm32sx16_timm, 0>; 753ecab8e4SMatt Arsenault def VREPIH : UnaryVRIa<"vrepih", 0xE745, z_replicate, v128h, imm32sx16_timm, 1>; 763ecab8e4SMatt Arsenault def VREPIF : UnaryVRIa<"vrepif", 0xE745, z_replicate, v128f, imm32sx16_timm, 2>; 773ecab8e4SMatt Arsenault def VREPIG : UnaryVRIa<"vrepig", 0xE745, z_replicate, v128g, imm32sx16_timm, 3>; 78d034e7ddSJonas Paulsson } 79d034e7ddSJonas Paulsson 80a8b04e1cSUlrich Weigand // Load element immediate. 81ce4c1095SUlrich Weigand // 82ce4c1095SUlrich Weigand // We want these instructions to be used ahead of VLVG* where possible. 83ce4c1095SUlrich Weigand // However, VLVG* takes a variable BD-format index whereas VLEI takes 84ce4c1095SUlrich Weigand // a plain immediate index. This means that VLVG* has an extra "base" 85ce4c1095SUlrich Weigand // register operand and is 3 units more complex. Bumping the complexity 86ce4c1095SUlrich Weigand // of the VLEI* instructions by 4 means that they are strictly better 87ce4c1095SUlrich Weigand // than VLVG* in cases where both forms match. 88ce4c1095SUlrich Weigand let AddedComplexity = 4 in { 89ce4c1095SUlrich Weigand def VLEIB : TernaryVRIa<"vleib", 0xE740, z_vector_insert, 90a8b04e1cSUlrich Weigand v128b, v128b, imm32sx16trunc, imm32zx4>; 91ce4c1095SUlrich Weigand def VLEIH : TernaryVRIa<"vleih", 0xE741, z_vector_insert, 92a8b04e1cSUlrich Weigand v128h, v128h, imm32sx16trunc, imm32zx3>; 93ce4c1095SUlrich Weigand def VLEIF : TernaryVRIa<"vleif", 0xE743, z_vector_insert, 94a8b04e1cSUlrich Weigand v128f, v128f, imm32sx16, imm32zx2>; 95ce4c1095SUlrich Weigand def VLEIG : TernaryVRIa<"vleig", 0xE742, z_vector_insert, 96a8b04e1cSUlrich Weigand v128g, v128g, imm64sx16, imm32zx1>; 97ce4c1095SUlrich Weigand } 98a8b04e1cSUlrich Weigand} 99a8b04e1cSUlrich Weigand 100a8b04e1cSUlrich Weigand//===----------------------------------------------------------------------===// 101a8b04e1cSUlrich Weigand// Loads 102a8b04e1cSUlrich Weigand//===----------------------------------------------------------------------===// 103a8b04e1cSUlrich Weigand 104a8b04e1cSUlrich Weigandlet Predicates = [FeatureVector] in { 105a8b04e1cSUlrich Weigand // Load. 1063641b10fSUlrich Weigand defm VL : UnaryVRXAlign<"vl", 0xE706>; 107a8b04e1cSUlrich Weigand 108a8b04e1cSUlrich Weigand // Load to block boundary. The number of loaded bytes is only known 109c1708b26SUlrich Weigand // at run time. The instruction is really polymorphic, but v128b matches 110c1708b26SUlrich Weigand // the return type of the associated intrinsic. 111c1708b26SUlrich Weigand def VLBB : BinaryVRX<"vlbb", 0xE707, int_s390_vlbb, v128b, 0>; 112a8b04e1cSUlrich Weigand 113a8b04e1cSUlrich Weigand // Load count to block boundary. 114a8b04e1cSUlrich Weigand let Defs = [CC] in 115a8b04e1cSUlrich Weigand def LCBB : InstRXE<0xE727, (outs GR32:$R1), 116a8b04e1cSUlrich Weigand (ins bdxaddr12only:$XBD2, imm32zx4:$M3), 117c1708b26SUlrich Weigand "lcbb\t$R1, $XBD2, $M3", 118c1708b26SUlrich Weigand [(set GR32:$R1, (int_s390_lcbb bdxaddr12only:$XBD2, 1193ecab8e4SMatt Arsenault imm32zx4_timm:$M3))]>; 120a8b04e1cSUlrich Weigand 121a8b04e1cSUlrich Weigand // Load with length. The number of loaded bytes is only known at run time. 122c1708b26SUlrich Weigand def VLL : BinaryVRSb<"vll", 0xE737, int_s390_vll, 0>; 123a8b04e1cSUlrich Weigand 124a8b04e1cSUlrich Weigand // Load multiple. 1253641b10fSUlrich Weigand defm VLM : LoadMultipleVRSaAlign<"vlm", 0xE736>; 126a8b04e1cSUlrich Weigand 127a8b04e1cSUlrich Weigand // Load and replicate 1286e31ab38SUlrich Weigand def VLREP : UnaryVRXGeneric<"vlrep", 0xE705>; 129ce4c1095SUlrich Weigand def VLREPB : UnaryVRX<"vlrepb", 0xE705, z_replicate_loadi8, v128b, 1, 0>; 130ce4c1095SUlrich Weigand def VLREPH : UnaryVRX<"vlreph", 0xE705, z_replicate_loadi16, v128h, 2, 1>; 131ce4c1095SUlrich Weigand def VLREPF : UnaryVRX<"vlrepf", 0xE705, z_replicate_loadi32, v128f, 4, 2>; 132ce4c1095SUlrich Weigand def VLREPG : UnaryVRX<"vlrepg", 0xE705, z_replicate_loadi64, v128g, 8, 3>; 13380b3af7aSUlrich Weigand def : Pat<(v4f32 (z_replicate_loadf32 bdxaddr12only:$addr)), 13480b3af7aSUlrich Weigand (VLREPF bdxaddr12only:$addr)>; 135cd808237SUlrich Weigand def : Pat<(v2f64 (z_replicate_loadf64 bdxaddr12only:$addr)), 136cd808237SUlrich Weigand (VLREPG bdxaddr12only:$addr)>; 137a8b04e1cSUlrich Weigand 13849506d78SUlrich Weigand // Use VLREP to load subvectors. These patterns use "12pair" because 13949506d78SUlrich Weigand // LEY and LDY offer full 20-bit displacement fields. It's often better 14049506d78SUlrich Weigand // to use those instructions rather than force a 20-bit displacement 14149506d78SUlrich Weigand // into a GPR temporary. 142b5b91cd4SJonas Paulsson let mayLoad = 1 in { 14333435c4cSUlrich Weigand def VL32 : UnaryAliasVRX<load, v32sb, bdxaddr12pair>; 14449506d78SUlrich Weigand def VL64 : UnaryAliasVRX<load, v64db, bdxaddr12pair>; 145b5b91cd4SJonas Paulsson } 14649506d78SUlrich Weigand 147a8b04e1cSUlrich Weigand // Load logical element and zero. 1486e31ab38SUlrich Weigand def VLLEZ : UnaryVRXGeneric<"vllez", 0xE704>; 149ce4c1095SUlrich Weigand def VLLEZB : UnaryVRX<"vllezb", 0xE704, z_vllezi8, v128b, 1, 0>; 150ce4c1095SUlrich Weigand def VLLEZH : UnaryVRX<"vllezh", 0xE704, z_vllezi16, v128h, 2, 1>; 151ce4c1095SUlrich Weigand def VLLEZF : UnaryVRX<"vllezf", 0xE704, z_vllezi32, v128f, 4, 2>; 152ce4c1095SUlrich Weigand def VLLEZG : UnaryVRX<"vllezg", 0xE704, z_vllezi64, v128g, 8, 3>; 15344d37ae3SUlrich Weigand def : Pat<(z_vllezf32 bdxaddr12only:$addr), 15480b3af7aSUlrich Weigand (VLLEZF bdxaddr12only:$addr)>; 15544d37ae3SUlrich Weigand def : Pat<(z_vllezf64 bdxaddr12only:$addr), 156cd808237SUlrich Weigand (VLLEZG bdxaddr12only:$addr)>; 1572b3482feSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in { 1582b3482feSUlrich Weigand def VLLEZLF : UnaryVRX<"vllezlf", 0xE704, z_vllezli32, v128f, 4, 6>; 15944d37ae3SUlrich Weigand def : Pat<(z_vllezlf32 bdxaddr12only:$addr), 1602b3482feSUlrich Weigand (VLLEZLF bdxaddr12only:$addr)>; 1612b3482feSUlrich Weigand } 162a8b04e1cSUlrich Weigand 163a8b04e1cSUlrich Weigand // Load element. 164ce4c1095SUlrich Weigand def VLEB : TernaryVRX<"vleb", 0xE700, z_vlei8, v128b, v128b, 1, imm32zx4>; 165ce4c1095SUlrich Weigand def VLEH : TernaryVRX<"vleh", 0xE701, z_vlei16, v128h, v128h, 2, imm32zx3>; 166ce4c1095SUlrich Weigand def VLEF : TernaryVRX<"vlef", 0xE703, z_vlei32, v128f, v128f, 4, imm32zx2>; 167ce4c1095SUlrich Weigand def VLEG : TernaryVRX<"vleg", 0xE702, z_vlei64, v128g, v128g, 8, imm32zx1>; 16880b3af7aSUlrich Weigand def : Pat<(z_vlef32 (v4f32 VR128:$val), bdxaddr12only:$addr, imm32zx2:$index), 16980b3af7aSUlrich Weigand (VLEF VR128:$val, bdxaddr12only:$addr, imm32zx2:$index)>; 170cd808237SUlrich Weigand def : Pat<(z_vlef64 (v2f64 VR128:$val), bdxaddr12only:$addr, imm32zx1:$index), 171cd808237SUlrich Weigand (VLEG VR128:$val, bdxaddr12only:$addr, imm32zx1:$index)>; 172a8b04e1cSUlrich Weigand 173a8b04e1cSUlrich Weigand // Gather element. 174a8b04e1cSUlrich Weigand def VGEF : TernaryVRV<"vgef", 0xE713, 4, imm32zx2>; 175a8b04e1cSUlrich Weigand def VGEG : TernaryVRV<"vgeg", 0xE712, 8, imm32zx1>; 176a8b04e1cSUlrich Weigand} 177a8b04e1cSUlrich Weigand 1782b3482feSUlrich Weigandlet Predicates = [FeatureVectorPackedDecimal] in { 1792b3482feSUlrich Weigand // Load rightmost with length. The number of loaded bytes is only known 180947f78acSUlrich Weigand // at run time. Note that while the instruction will accept immediate 181947f78acSUlrich Weigand // lengths larger that 15 at runtime, those will always result in a trap, 182947f78acSUlrich Weigand // so we never emit them here. 183947f78acSUlrich Weigand def VLRL : BinaryVSI<"vlrl", 0xE635, null_frag, 0>; 1842b3482feSUlrich Weigand def VLRLR : BinaryVRSd<"vlrlr", 0xE637, int_s390_vlrl, 0>; 185947f78acSUlrich Weigand def : Pat<(int_s390_vlrl imm32zx4:$len, bdaddr12only:$addr), 186947f78acSUlrich Weigand (VLRL bdaddr12only:$addr, imm32zx4:$len)>; 1872b3482feSUlrich Weigand} 1882b3482feSUlrich Weigand 189ce4c1095SUlrich Weigand// Use replicating loads if we're inserting a single element into an 190ce4c1095SUlrich Weigand// undefined vector. This avoids a false dependency on the previous 191ce4c1095SUlrich Weigand// register contents. 192ce4c1095SUlrich Weigandmulticlass ReplicatePeephole<Instruction vlrep, ValueType vectype, 193ce4c1095SUlrich Weigand SDPatternOperator load, ValueType scalartype> { 194ce4c1095SUlrich Weigand def : Pat<(vectype (z_vector_insert 195ce4c1095SUlrich Weigand (undef), (scalartype (load bdxaddr12only:$addr)), 0)), 196ce4c1095SUlrich Weigand (vlrep bdxaddr12only:$addr)>; 197ce4c1095SUlrich Weigand def : Pat<(vectype (scalar_to_vector 198ce4c1095SUlrich Weigand (scalartype (load bdxaddr12only:$addr)))), 199ce4c1095SUlrich Weigand (vlrep bdxaddr12only:$addr)>; 200ce4c1095SUlrich Weigand} 201ce4c1095SUlrich Weiganddefm : ReplicatePeephole<VLREPB, v16i8, anyextloadi8, i32>; 202ce4c1095SUlrich Weiganddefm : ReplicatePeephole<VLREPH, v8i16, anyextloadi16, i32>; 203ce4c1095SUlrich Weiganddefm : ReplicatePeephole<VLREPF, v4i32, load, i32>; 204ce4c1095SUlrich Weiganddefm : ReplicatePeephole<VLREPG, v2i64, load, i64>; 20580b3af7aSUlrich Weiganddefm : ReplicatePeephole<VLREPF, v4f32, load, f32>; 206cd808237SUlrich Weiganddefm : ReplicatePeephole<VLREPG, v2f64, load, f64>; 207ce4c1095SUlrich Weigand 208a8b04e1cSUlrich Weigand//===----------------------------------------------------------------------===// 209a8b04e1cSUlrich Weigand// Stores 210a8b04e1cSUlrich Weigand//===----------------------------------------------------------------------===// 211a8b04e1cSUlrich Weigand 212a8b04e1cSUlrich Weigandlet Predicates = [FeatureVector] in { 213a8b04e1cSUlrich Weigand // Store. 2143641b10fSUlrich Weigand defm VST : StoreVRXAlign<"vst", 0xE70E>; 215a8b04e1cSUlrich Weigand 216a8b04e1cSUlrich Weigand // Store with length. The number of stored bytes is only known at run time. 217c1708b26SUlrich Weigand def VSTL : StoreLengthVRSb<"vstl", 0xE73F, int_s390_vstl, 0>; 218a8b04e1cSUlrich Weigand 219a8b04e1cSUlrich Weigand // Store multiple. 2203641b10fSUlrich Weigand defm VSTM : StoreMultipleVRSaAlign<"vstm", 0xE73E>; 221a8b04e1cSUlrich Weigand 222a8b04e1cSUlrich Weigand // Store element. 223ce4c1095SUlrich Weigand def VSTEB : StoreBinaryVRX<"vsteb", 0xE708, z_vstei8, v128b, 1, imm32zx4>; 224ce4c1095SUlrich Weigand def VSTEH : StoreBinaryVRX<"vsteh", 0xE709, z_vstei16, v128h, 2, imm32zx3>; 225ce4c1095SUlrich Weigand def VSTEF : StoreBinaryVRX<"vstef", 0xE70B, z_vstei32, v128f, 4, imm32zx2>; 226ce4c1095SUlrich Weigand def VSTEG : StoreBinaryVRX<"vsteg", 0xE70A, z_vstei64, v128g, 8, imm32zx1>; 22780b3af7aSUlrich Weigand def : Pat<(z_vstef32 (v4f32 VR128:$val), bdxaddr12only:$addr, 22880b3af7aSUlrich Weigand imm32zx2:$index), 22980b3af7aSUlrich Weigand (VSTEF VR128:$val, bdxaddr12only:$addr, imm32zx2:$index)>; 230cd808237SUlrich Weigand def : Pat<(z_vstef64 (v2f64 VR128:$val), bdxaddr12only:$addr, 231cd808237SUlrich Weigand imm32zx1:$index), 232cd808237SUlrich Weigand (VSTEG VR128:$val, bdxaddr12only:$addr, imm32zx1:$index)>; 233a8b04e1cSUlrich Weigand 23449506d78SUlrich Weigand // Use VSTE to store subvectors. These patterns use "12pair" because 23549506d78SUlrich Weigand // STEY and STDY offer full 20-bit displacement fields. It's often better 23649506d78SUlrich Weigand // to use those instructions rather than force a 20-bit displacement 23749506d78SUlrich Weigand // into a GPR temporary. 238b5b91cd4SJonas Paulsson let mayStore = 1 in { 23933435c4cSUlrich Weigand def VST32 : StoreAliasVRX<store, v32sb, bdxaddr12pair>; 24049506d78SUlrich Weigand def VST64 : StoreAliasVRX<store, v64db, bdxaddr12pair>; 241b5b91cd4SJonas Paulsson } 24249506d78SUlrich Weigand 243a8b04e1cSUlrich Weigand // Scatter element. 244a8b04e1cSUlrich Weigand def VSCEF : StoreBinaryVRV<"vscef", 0xE71B, 4, imm32zx2>; 245a8b04e1cSUlrich Weigand def VSCEG : StoreBinaryVRV<"vsceg", 0xE71A, 8, imm32zx1>; 246a8b04e1cSUlrich Weigand} 247a8b04e1cSUlrich Weigand 2482b3482feSUlrich Weigandlet Predicates = [FeatureVectorPackedDecimal] in { 2492b3482feSUlrich Weigand // Store rightmost with length. The number of stored bytes is only known 250947f78acSUlrich Weigand // at run time. Note that while the instruction will accept immediate 251947f78acSUlrich Weigand // lengths larger that 15 at runtime, those will always result in a trap, 252947f78acSUlrich Weigand // so we never emit them here. 253947f78acSUlrich Weigand def VSTRL : StoreLengthVSI<"vstrl", 0xE63D, null_frag, 0>; 2542b3482feSUlrich Weigand def VSTRLR : StoreLengthVRSd<"vstrlr", 0xE63F, int_s390_vstrl, 0>; 255947f78acSUlrich Weigand def : Pat<(int_s390_vstrl VR128:$val, imm32zx4:$len, bdaddr12only:$addr), 256947f78acSUlrich Weigand (VSTRL VR128:$val, bdaddr12only:$addr, imm32zx4:$len)>; 2572b3482feSUlrich Weigand} 2582b3482feSUlrich Weigand 259a8b04e1cSUlrich Weigand//===----------------------------------------------------------------------===// 2600f0a8b77SUlrich Weigand// Byte swaps 2610f0a8b77SUlrich Weigand//===----------------------------------------------------------------------===// 2620f0a8b77SUlrich Weigand 2630f0a8b77SUlrich Weigandlet Predicates = [FeatureVectorEnhancements2] in { 2640f0a8b77SUlrich Weigand // Load byte-reversed elements. 2650f0a8b77SUlrich Weigand def VLBR : UnaryVRXGeneric<"vlbr", 0xE606>; 2660f0a8b77SUlrich Weigand def VLBRH : UnaryVRX<"vlbrh", 0xE606, z_loadbswap, v128h, 16, 1>; 2670f0a8b77SUlrich Weigand def VLBRF : UnaryVRX<"vlbrf", 0xE606, z_loadbswap, v128f, 16, 2>; 2680f0a8b77SUlrich Weigand def VLBRG : UnaryVRX<"vlbrg", 0xE606, z_loadbswap, v128g, 16, 3>; 2690f0a8b77SUlrich Weigand def VLBRQ : UnaryVRX<"vlbrq", 0xE606, null_frag, v128q, 16, 4>; 2700f0a8b77SUlrich Weigand 2710f0a8b77SUlrich Weigand // Load elements reversed. 2720f0a8b77SUlrich Weigand def VLER : UnaryVRXGeneric<"vler", 0xE607>; 2730f0a8b77SUlrich Weigand def VLERH : UnaryVRX<"vlerh", 0xE607, z_loadeswap, v128h, 16, 1>; 2740f0a8b77SUlrich Weigand def VLERF : UnaryVRX<"vlerf", 0xE607, z_loadeswap, v128f, 16, 2>; 2750f0a8b77SUlrich Weigand def VLERG : UnaryVRX<"vlerg", 0xE607, z_loadeswap, v128g, 16, 3>; 2760f0a8b77SUlrich Weigand def : Pat<(v4f32 (z_loadeswap bdxaddr12only:$addr)), 2770f0a8b77SUlrich Weigand (VLERF bdxaddr12only:$addr)>; 2780f0a8b77SUlrich Weigand def : Pat<(v2f64 (z_loadeswap bdxaddr12only:$addr)), 2790f0a8b77SUlrich Weigand (VLERG bdxaddr12only:$addr)>; 2800f0a8b77SUlrich Weigand def : Pat<(v16i8 (z_loadeswap bdxaddr12only:$addr)), 2810f0a8b77SUlrich Weigand (VLBRQ bdxaddr12only:$addr)>; 2820f0a8b77SUlrich Weigand 2830f0a8b77SUlrich Weigand // Load byte-reversed element. 2840f0a8b77SUlrich Weigand def VLEBRH : TernaryVRX<"vlebrh", 0xE601, z_vlebri16, v128h, v128h, 2, imm32zx3>; 2850f0a8b77SUlrich Weigand def VLEBRF : TernaryVRX<"vlebrf", 0xE603, z_vlebri32, v128f, v128f, 4, imm32zx2>; 2860f0a8b77SUlrich Weigand def VLEBRG : TernaryVRX<"vlebrg", 0xE602, z_vlebri64, v128g, v128g, 8, imm32zx1>; 2870f0a8b77SUlrich Weigand 2880f0a8b77SUlrich Weigand // Load byte-reversed element and zero. 2890f0a8b77SUlrich Weigand def VLLEBRZ : UnaryVRXGeneric<"vllebrz", 0xE604>; 2900f0a8b77SUlrich Weigand def VLLEBRZH : UnaryVRX<"vllebrzh", 0xE604, z_vllebrzi16, v128h, 2, 1>; 2910f0a8b77SUlrich Weigand def VLLEBRZF : UnaryVRX<"vllebrzf", 0xE604, z_vllebrzi32, v128f, 4, 2>; 2920f0a8b77SUlrich Weigand def VLLEBRZG : UnaryVRX<"vllebrzg", 0xE604, z_vllebrzi64, v128g, 8, 3>; 2930f0a8b77SUlrich Weigand def VLLEBRZE : UnaryVRX<"vllebrze", 0xE604, z_vllebrzli32, v128f, 4, 6>; 2940f0a8b77SUlrich Weigand def : InstAlias<"lerv\t$V1, $XBD2", 2950f0a8b77SUlrich Weigand (VLLEBRZE VR128:$V1, bdxaddr12only:$XBD2), 0>; 2960f0a8b77SUlrich Weigand def : InstAlias<"ldrv\t$V1, $XBD2", 2970f0a8b77SUlrich Weigand (VLLEBRZG VR128:$V1, bdxaddr12only:$XBD2), 0>; 2980f0a8b77SUlrich Weigand 2990f0a8b77SUlrich Weigand // Load byte-reversed element and replicate. 3000f0a8b77SUlrich Weigand def VLBRREP : UnaryVRXGeneric<"vlbrrep", 0xE605>; 3010f0a8b77SUlrich Weigand def VLBRREPH : UnaryVRX<"vlbrreph", 0xE605, z_replicate_loadbswapi16, v128h, 2, 1>; 3020f0a8b77SUlrich Weigand def VLBRREPF : UnaryVRX<"vlbrrepf", 0xE605, z_replicate_loadbswapi32, v128f, 4, 2>; 3030f0a8b77SUlrich Weigand def VLBRREPG : UnaryVRX<"vlbrrepg", 0xE605, z_replicate_loadbswapi64, v128g, 8, 3>; 3040f0a8b77SUlrich Weigand 3050f0a8b77SUlrich Weigand // Store byte-reversed elements. 3060f0a8b77SUlrich Weigand def VSTBR : StoreVRXGeneric<"vstbr", 0xE60E>; 3070f0a8b77SUlrich Weigand def VSTBRH : StoreVRX<"vstbrh", 0xE60E, z_storebswap, v128h, 16, 1>; 3080f0a8b77SUlrich Weigand def VSTBRF : StoreVRX<"vstbrf", 0xE60E, z_storebswap, v128f, 16, 2>; 3090f0a8b77SUlrich Weigand def VSTBRG : StoreVRX<"vstbrg", 0xE60E, z_storebswap, v128g, 16, 3>; 3100f0a8b77SUlrich Weigand def VSTBRQ : StoreVRX<"vstbrq", 0xE60E, null_frag, v128q, 16, 4>; 3110f0a8b77SUlrich Weigand 3120f0a8b77SUlrich Weigand // Store elements reversed. 3130f0a8b77SUlrich Weigand def VSTER : StoreVRXGeneric<"vster", 0xE60F>; 3140f0a8b77SUlrich Weigand def VSTERH : StoreVRX<"vsterh", 0xE60F, z_storeeswap, v128h, 16, 1>; 3150f0a8b77SUlrich Weigand def VSTERF : StoreVRX<"vsterf", 0xE60F, z_storeeswap, v128f, 16, 2>; 3160f0a8b77SUlrich Weigand def VSTERG : StoreVRX<"vsterg", 0xE60F, z_storeeswap, v128g, 16, 3>; 3170f0a8b77SUlrich Weigand def : Pat<(z_storeeswap (v4f32 VR128:$val), bdxaddr12only:$addr), 3180f0a8b77SUlrich Weigand (VSTERF VR128:$val, bdxaddr12only:$addr)>; 3190f0a8b77SUlrich Weigand def : Pat<(z_storeeswap (v2f64 VR128:$val), bdxaddr12only:$addr), 3200f0a8b77SUlrich Weigand (VSTERG VR128:$val, bdxaddr12only:$addr)>; 3210f0a8b77SUlrich Weigand def : Pat<(z_storeeswap (v16i8 VR128:$val), bdxaddr12only:$addr), 3220f0a8b77SUlrich Weigand (VSTBRQ VR128:$val, bdxaddr12only:$addr)>; 3230f0a8b77SUlrich Weigand 3240f0a8b77SUlrich Weigand // Store byte-reversed element. 3250f0a8b77SUlrich Weigand def VSTEBRH : StoreBinaryVRX<"vstebrh", 0xE609, z_vstebri16, v128h, 2, imm32zx3>; 3260f0a8b77SUlrich Weigand def VSTEBRF : StoreBinaryVRX<"vstebrf", 0xE60B, z_vstebri32, v128f, 4, imm32zx2>; 3270f0a8b77SUlrich Weigand def VSTEBRG : StoreBinaryVRX<"vstebrg", 0xE60A, z_vstebri64, v128g, 8, imm32zx1>; 3280f0a8b77SUlrich Weigand def : InstAlias<"sterv\t$V1, $XBD2", 3290f0a8b77SUlrich Weigand (VSTEBRF VR128:$V1, bdxaddr12only:$XBD2, 0), 0>; 3300f0a8b77SUlrich Weigand def : InstAlias<"stdrv\t$V1, $XBD2", 3310f0a8b77SUlrich Weigand (VSTEBRG VR128:$V1, bdxaddr12only:$XBD2, 0), 0>; 3320f0a8b77SUlrich Weigand} 3330f0a8b77SUlrich Weigand 3340f0a8b77SUlrich Weigand//===----------------------------------------------------------------------===// 335a8b04e1cSUlrich Weigand// Selects and permutes 336a8b04e1cSUlrich Weigand//===----------------------------------------------------------------------===// 337a8b04e1cSUlrich Weigand 338a8b04e1cSUlrich Weigandlet Predicates = [FeatureVector] in { 339a8b04e1cSUlrich Weigand // Merge high. 3406e31ab38SUlrich Weigand def VMRH: BinaryVRRcGeneric<"vmrh", 0xE761>; 341ce4c1095SUlrich Weigand def VMRHB : BinaryVRRc<"vmrhb", 0xE761, z_merge_high, v128b, v128b, 0>; 342ce4c1095SUlrich Weigand def VMRHH : BinaryVRRc<"vmrhh", 0xE761, z_merge_high, v128h, v128h, 1>; 343ce4c1095SUlrich Weigand def VMRHF : BinaryVRRc<"vmrhf", 0xE761, z_merge_high, v128f, v128f, 2>; 344ce4c1095SUlrich Weigand def VMRHG : BinaryVRRc<"vmrhg", 0xE761, z_merge_high, v128g, v128g, 3>; 34580b3af7aSUlrich Weigand def : BinaryRRWithType<VMRHF, VR128, z_merge_high, v4f32>; 346cd808237SUlrich Weigand def : BinaryRRWithType<VMRHG, VR128, z_merge_high, v2f64>; 347a8b04e1cSUlrich Weigand 348a8b04e1cSUlrich Weigand // Merge low. 3496e31ab38SUlrich Weigand def VMRL: BinaryVRRcGeneric<"vmrl", 0xE760>; 350ce4c1095SUlrich Weigand def VMRLB : BinaryVRRc<"vmrlb", 0xE760, z_merge_low, v128b, v128b, 0>; 351ce4c1095SUlrich Weigand def VMRLH : BinaryVRRc<"vmrlh", 0xE760, z_merge_low, v128h, v128h, 1>; 352ce4c1095SUlrich Weigand def VMRLF : BinaryVRRc<"vmrlf", 0xE760, z_merge_low, v128f, v128f, 2>; 353ce4c1095SUlrich Weigand def VMRLG : BinaryVRRc<"vmrlg", 0xE760, z_merge_low, v128g, v128g, 3>; 35480b3af7aSUlrich Weigand def : BinaryRRWithType<VMRLF, VR128, z_merge_low, v4f32>; 355cd808237SUlrich Weigand def : BinaryRRWithType<VMRLG, VR128, z_merge_low, v2f64>; 356a8b04e1cSUlrich Weigand 357a8b04e1cSUlrich Weigand // Permute. 358ce4c1095SUlrich Weigand def VPERM : TernaryVRRe<"vperm", 0xE78C, z_permute, v128b, v128b>; 359a8b04e1cSUlrich Weigand 360a8b04e1cSUlrich Weigand // Permute doubleword immediate. 361ce4c1095SUlrich Weigand def VPDI : TernaryVRRc<"vpdi", 0xE784, z_permute_dwords, v128g, v128g>; 362a8b04e1cSUlrich Weigand 3632b3482feSUlrich Weigand // Bit Permute. 3642b3482feSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in 3652b3482feSUlrich Weigand def VBPERM : BinaryVRRc<"vbperm", 0xE785, int_s390_vbperm, v128g, v128b>; 3662b3482feSUlrich Weigand 367a8b04e1cSUlrich Weigand // Replicate. 3686e31ab38SUlrich Weigand def VREP: BinaryVRIcGeneric<"vrep", 0xE74D>; 369ce4c1095SUlrich Weigand def VREPB : BinaryVRIc<"vrepb", 0xE74D, z_splat, v128b, v128b, 0>; 370ce4c1095SUlrich Weigand def VREPH : BinaryVRIc<"vreph", 0xE74D, z_splat, v128h, v128h, 1>; 371ce4c1095SUlrich Weigand def VREPF : BinaryVRIc<"vrepf", 0xE74D, z_splat, v128f, v128f, 2>; 372ce4c1095SUlrich Weigand def VREPG : BinaryVRIc<"vrepg", 0xE74D, z_splat, v128g, v128g, 3>; 3733ecab8e4SMatt Arsenault def : Pat<(v4f32 (z_splat VR128:$vec, imm32zx16_timm:$index)), 37480b3af7aSUlrich Weigand (VREPF VR128:$vec, imm32zx16:$index)>; 3753ecab8e4SMatt Arsenault def : Pat<(v2f64 (z_splat VR128:$vec, imm32zx16_timm:$index)), 376cd808237SUlrich Weigand (VREPG VR128:$vec, imm32zx16:$index)>; 377a8b04e1cSUlrich Weigand 378a8b04e1cSUlrich Weigand // Select. 379a8b04e1cSUlrich Weigand def VSEL : TernaryVRRe<"vsel", 0xE78D, null_frag, v128any, v128any>; 380a8b04e1cSUlrich Weigand} 381a8b04e1cSUlrich Weigand 382a8b04e1cSUlrich Weigand//===----------------------------------------------------------------------===// 383a8b04e1cSUlrich Weigand// Widening and narrowing 384a8b04e1cSUlrich Weigand//===----------------------------------------------------------------------===// 385a8b04e1cSUlrich Weigand 386a8b04e1cSUlrich Weigandlet Predicates = [FeatureVector] in { 387a8b04e1cSUlrich Weigand // Pack 3886e31ab38SUlrich Weigand def VPK : BinaryVRRcGeneric<"vpk", 0xE794>; 389ce4c1095SUlrich Weigand def VPKH : BinaryVRRc<"vpkh", 0xE794, z_pack, v128b, v128h, 1>; 390ce4c1095SUlrich Weigand def VPKF : BinaryVRRc<"vpkf", 0xE794, z_pack, v128h, v128f, 2>; 391ce4c1095SUlrich Weigand def VPKG : BinaryVRRc<"vpkg", 0xE794, z_pack, v128f, v128g, 3>; 392a8b04e1cSUlrich Weigand 393a8b04e1cSUlrich Weigand // Pack saturate. 3946e31ab38SUlrich Weigand def VPKS : BinaryVRRbSPairGeneric<"vpks", 0xE797>; 395c1708b26SUlrich Weigand defm VPKSH : BinaryVRRbSPair<"vpksh", 0xE797, int_s390_vpksh, z_packs_cc, 396a8b04e1cSUlrich Weigand v128b, v128h, 1>; 397c1708b26SUlrich Weigand defm VPKSF : BinaryVRRbSPair<"vpksf", 0xE797, int_s390_vpksf, z_packs_cc, 398a8b04e1cSUlrich Weigand v128h, v128f, 2>; 399c1708b26SUlrich Weigand defm VPKSG : BinaryVRRbSPair<"vpksg", 0xE797, int_s390_vpksg, z_packs_cc, 400a8b04e1cSUlrich Weigand v128f, v128g, 3>; 401a8b04e1cSUlrich Weigand 402a8b04e1cSUlrich Weigand // Pack saturate logical. 4036e31ab38SUlrich Weigand def VPKLS : BinaryVRRbSPairGeneric<"vpkls", 0xE795>; 404c1708b26SUlrich Weigand defm VPKLSH : BinaryVRRbSPair<"vpklsh", 0xE795, int_s390_vpklsh, z_packls_cc, 405a8b04e1cSUlrich Weigand v128b, v128h, 1>; 406c1708b26SUlrich Weigand defm VPKLSF : BinaryVRRbSPair<"vpklsf", 0xE795, int_s390_vpklsf, z_packls_cc, 407a8b04e1cSUlrich Weigand v128h, v128f, 2>; 408c1708b26SUlrich Weigand defm VPKLSG : BinaryVRRbSPair<"vpklsg", 0xE795, int_s390_vpklsg, z_packls_cc, 409a8b04e1cSUlrich Weigand v128f, v128g, 3>; 410a8b04e1cSUlrich Weigand 411a8b04e1cSUlrich Weigand // Sign-extend to doubleword. 4126e31ab38SUlrich Weigand def VSEG : UnaryVRRaGeneric<"vseg", 0xE75F>; 413ce4c1095SUlrich Weigand def VSEGB : UnaryVRRa<"vsegb", 0xE75F, z_vsei8, v128g, v128g, 0>; 414ce4c1095SUlrich Weigand def VSEGH : UnaryVRRa<"vsegh", 0xE75F, z_vsei16, v128g, v128g, 1>; 415ce4c1095SUlrich Weigand def VSEGF : UnaryVRRa<"vsegf", 0xE75F, z_vsei32, v128g, v128g, 2>; 416ce4c1095SUlrich Weigand def : Pat<(z_vsei8_by_parts (v16i8 VR128:$src)), (VSEGB VR128:$src)>; 417ce4c1095SUlrich Weigand def : Pat<(z_vsei16_by_parts (v8i16 VR128:$src)), (VSEGH VR128:$src)>; 418ce4c1095SUlrich Weigand def : Pat<(z_vsei32_by_parts (v4i32 VR128:$src)), (VSEGF VR128:$src)>; 419a8b04e1cSUlrich Weigand 420a8b04e1cSUlrich Weigand // Unpack high. 4216e31ab38SUlrich Weigand def VUPH : UnaryVRRaGeneric<"vuph", 0xE7D7>; 422cd2a1b53SUlrich Weigand def VUPHB : UnaryVRRa<"vuphb", 0xE7D7, z_unpack_high, v128h, v128b, 0>; 423cd2a1b53SUlrich Weigand def VUPHH : UnaryVRRa<"vuphh", 0xE7D7, z_unpack_high, v128f, v128h, 1>; 424cd2a1b53SUlrich Weigand def VUPHF : UnaryVRRa<"vuphf", 0xE7D7, z_unpack_high, v128g, v128f, 2>; 425a8b04e1cSUlrich Weigand 426a8b04e1cSUlrich Weigand // Unpack logical high. 4276e31ab38SUlrich Weigand def VUPLH : UnaryVRRaGeneric<"vuplh", 0xE7D5>; 428cd2a1b53SUlrich Weigand def VUPLHB : UnaryVRRa<"vuplhb", 0xE7D5, z_unpackl_high, v128h, v128b, 0>; 429cd2a1b53SUlrich Weigand def VUPLHH : UnaryVRRa<"vuplhh", 0xE7D5, z_unpackl_high, v128f, v128h, 1>; 430cd2a1b53SUlrich Weigand def VUPLHF : UnaryVRRa<"vuplhf", 0xE7D5, z_unpackl_high, v128g, v128f, 2>; 431a8b04e1cSUlrich Weigand 432a8b04e1cSUlrich Weigand // Unpack low. 4336e31ab38SUlrich Weigand def VUPL : UnaryVRRaGeneric<"vupl", 0xE7D6>; 434cd2a1b53SUlrich Weigand def VUPLB : UnaryVRRa<"vuplb", 0xE7D6, z_unpack_low, v128h, v128b, 0>; 435cd2a1b53SUlrich Weigand def VUPLHW : UnaryVRRa<"vuplhw", 0xE7D6, z_unpack_low, v128f, v128h, 1>; 436cd2a1b53SUlrich Weigand def VUPLF : UnaryVRRa<"vuplf", 0xE7D6, z_unpack_low, v128g, v128f, 2>; 437a8b04e1cSUlrich Weigand 438a8b04e1cSUlrich Weigand // Unpack logical low. 4396e31ab38SUlrich Weigand def VUPLL : UnaryVRRaGeneric<"vupll", 0xE7D4>; 440cd2a1b53SUlrich Weigand def VUPLLB : UnaryVRRa<"vupllb", 0xE7D4, z_unpackl_low, v128h, v128b, 0>; 441cd2a1b53SUlrich Weigand def VUPLLH : UnaryVRRa<"vupllh", 0xE7D4, z_unpackl_low, v128f, v128h, 1>; 442cd2a1b53SUlrich Weigand def VUPLLF : UnaryVRRa<"vupllf", 0xE7D4, z_unpackl_low, v128g, v128f, 2>; 443a8b04e1cSUlrich Weigand} 444a8b04e1cSUlrich Weigand 445a8b04e1cSUlrich Weigand//===----------------------------------------------------------------------===// 446ce4c1095SUlrich Weigand// Instantiating generic operations for specific types. 447ce4c1095SUlrich Weigand//===----------------------------------------------------------------------===// 448ce4c1095SUlrich Weigand 449ce4c1095SUlrich Weigandmulticlass GenericVectorOps<ValueType type, ValueType inttype> { 450ce4c1095SUlrich Weigand let Predicates = [FeatureVector] in { 451ce4c1095SUlrich Weigand def : Pat<(type (load bdxaddr12only:$addr)), 452ce4c1095SUlrich Weigand (VL bdxaddr12only:$addr)>; 453ce4c1095SUlrich Weigand def : Pat<(store (type VR128:$src), bdxaddr12only:$addr), 454ce4c1095SUlrich Weigand (VST VR128:$src, bdxaddr12only:$addr)>; 455ce4c1095SUlrich Weigand def : Pat<(type (vselect (inttype VR128:$x), VR128:$y, VR128:$z)), 456ce4c1095SUlrich Weigand (VSEL VR128:$y, VR128:$z, VR128:$x)>; 457ce4c1095SUlrich Weigand def : Pat<(type (vselect (inttype (z_vnot VR128:$x)), VR128:$y, VR128:$z)), 458ce4c1095SUlrich Weigand (VSEL VR128:$z, VR128:$y, VR128:$x)>; 459ce4c1095SUlrich Weigand } 460ce4c1095SUlrich Weigand} 461ce4c1095SUlrich Weigand 462ce4c1095SUlrich Weiganddefm : GenericVectorOps<v16i8, v16i8>; 463ce4c1095SUlrich Weiganddefm : GenericVectorOps<v8i16, v8i16>; 464ce4c1095SUlrich Weiganddefm : GenericVectorOps<v4i32, v4i32>; 465ce4c1095SUlrich Weiganddefm : GenericVectorOps<v2i64, v2i64>; 46680b3af7aSUlrich Weiganddefm : GenericVectorOps<v4f32, v4i32>; 467cd808237SUlrich Weiganddefm : GenericVectorOps<v2f64, v2i64>; 468ce4c1095SUlrich Weigand 469ce4c1095SUlrich Weigand//===----------------------------------------------------------------------===// 470a8b04e1cSUlrich Weigand// Integer arithmetic 471a8b04e1cSUlrich Weigand//===----------------------------------------------------------------------===// 472a8b04e1cSUlrich Weigand 473a8b04e1cSUlrich Weigandlet Predicates = [FeatureVector] in { 4747e02da7dSJonas Paulsson let isCommutable = 1 in { 475a8b04e1cSUlrich Weigand // Add. 4766e31ab38SUlrich Weigand def VA : BinaryVRRcGeneric<"va", 0xE7F3>; 477ce4c1095SUlrich Weigand def VAB : BinaryVRRc<"vab", 0xE7F3, add, v128b, v128b, 0>; 478ce4c1095SUlrich Weigand def VAH : BinaryVRRc<"vah", 0xE7F3, add, v128h, v128h, 1>; 479ce4c1095SUlrich Weigand def VAF : BinaryVRRc<"vaf", 0xE7F3, add, v128f, v128f, 2>; 480ce4c1095SUlrich Weigand def VAG : BinaryVRRc<"vag", 0xE7F3, add, v128g, v128g, 3>; 481c1708b26SUlrich Weigand def VAQ : BinaryVRRc<"vaq", 0xE7F3, int_s390_vaq, v128q, v128q, 4>; 4827e02da7dSJonas Paulsson } 483a8b04e1cSUlrich Weigand 4847e02da7dSJonas Paulsson let isCommutable = 1 in { 485a8b04e1cSUlrich Weigand // Add compute carry. 4866e31ab38SUlrich Weigand def VACC : BinaryVRRcGeneric<"vacc", 0xE7F1>; 487c1708b26SUlrich Weigand def VACCB : BinaryVRRc<"vaccb", 0xE7F1, int_s390_vaccb, v128b, v128b, 0>; 488c1708b26SUlrich Weigand def VACCH : BinaryVRRc<"vacch", 0xE7F1, int_s390_vacch, v128h, v128h, 1>; 489c1708b26SUlrich Weigand def VACCF : BinaryVRRc<"vaccf", 0xE7F1, int_s390_vaccf, v128f, v128f, 2>; 490c1708b26SUlrich Weigand def VACCG : BinaryVRRc<"vaccg", 0xE7F1, int_s390_vaccg, v128g, v128g, 3>; 491c1708b26SUlrich Weigand def VACCQ : BinaryVRRc<"vaccq", 0xE7F1, int_s390_vaccq, v128q, v128q, 4>; 492a8b04e1cSUlrich Weigand 493a8b04e1cSUlrich Weigand // Add with carry. 4946e31ab38SUlrich Weigand def VAC : TernaryVRRdGeneric<"vac", 0xE7BB>; 495c1708b26SUlrich Weigand def VACQ : TernaryVRRd<"vacq", 0xE7BB, int_s390_vacq, v128q, v128q, 4>; 496a8b04e1cSUlrich Weigand 497a8b04e1cSUlrich Weigand // Add with carry compute carry. 4986e31ab38SUlrich Weigand def VACCC : TernaryVRRdGeneric<"vaccc", 0xE7B9>; 499c1708b26SUlrich Weigand def VACCCQ : TernaryVRRd<"vacccq", 0xE7B9, int_s390_vacccq, v128q, v128q, 4>; 5007e02da7dSJonas Paulsson } 501a8b04e1cSUlrich Weigand 502a8b04e1cSUlrich Weigand // And. 5037e02da7dSJonas Paulsson let isCommutable = 1 in 504a8b04e1cSUlrich Weigand def VN : BinaryVRRc<"vn", 0xE768, null_frag, v128any, v128any>; 505a8b04e1cSUlrich Weigand 506a8b04e1cSUlrich Weigand // And with complement. 507a8b04e1cSUlrich Weigand def VNC : BinaryVRRc<"vnc", 0xE769, null_frag, v128any, v128any>; 508a8b04e1cSUlrich Weigand 5097e02da7dSJonas Paulsson let isCommutable = 1 in { 510a8b04e1cSUlrich Weigand // Average. 5116e31ab38SUlrich Weigand def VAVG : BinaryVRRcGeneric<"vavg", 0xE7F2>; 512c1708b26SUlrich Weigand def VAVGB : BinaryVRRc<"vavgb", 0xE7F2, int_s390_vavgb, v128b, v128b, 0>; 513c1708b26SUlrich Weigand def VAVGH : BinaryVRRc<"vavgh", 0xE7F2, int_s390_vavgh, v128h, v128h, 1>; 514c1708b26SUlrich Weigand def VAVGF : BinaryVRRc<"vavgf", 0xE7F2, int_s390_vavgf, v128f, v128f, 2>; 515c1708b26SUlrich Weigand def VAVGG : BinaryVRRc<"vavgg", 0xE7F2, int_s390_vavgg, v128g, v128g, 3>; 516a8b04e1cSUlrich Weigand 517a8b04e1cSUlrich Weigand // Average logical. 5186e31ab38SUlrich Weigand def VAVGL : BinaryVRRcGeneric<"vavgl", 0xE7F0>; 519c1708b26SUlrich Weigand def VAVGLB : BinaryVRRc<"vavglb", 0xE7F0, int_s390_vavglb, v128b, v128b, 0>; 520c1708b26SUlrich Weigand def VAVGLH : BinaryVRRc<"vavglh", 0xE7F0, int_s390_vavglh, v128h, v128h, 1>; 521c1708b26SUlrich Weigand def VAVGLF : BinaryVRRc<"vavglf", 0xE7F0, int_s390_vavglf, v128f, v128f, 2>; 522c1708b26SUlrich Weigand def VAVGLG : BinaryVRRc<"vavglg", 0xE7F0, int_s390_vavglg, v128g, v128g, 3>; 5237e02da7dSJonas Paulsson } 524a8b04e1cSUlrich Weigand 525a8b04e1cSUlrich Weigand // Checksum. 526c1708b26SUlrich Weigand def VCKSM : BinaryVRRc<"vcksm", 0xE766, int_s390_vcksm, v128f, v128f>; 527a8b04e1cSUlrich Weigand 528a8b04e1cSUlrich Weigand // Count leading zeros. 5296e31ab38SUlrich Weigand def VCLZ : UnaryVRRaGeneric<"vclz", 0xE753>; 530ce4c1095SUlrich Weigand def VCLZB : UnaryVRRa<"vclzb", 0xE753, ctlz, v128b, v128b, 0>; 531ce4c1095SUlrich Weigand def VCLZH : UnaryVRRa<"vclzh", 0xE753, ctlz, v128h, v128h, 1>; 532ce4c1095SUlrich Weigand def VCLZF : UnaryVRRa<"vclzf", 0xE753, ctlz, v128f, v128f, 2>; 533ce4c1095SUlrich Weigand def VCLZG : UnaryVRRa<"vclzg", 0xE753, ctlz, v128g, v128g, 3>; 534a8b04e1cSUlrich Weigand 535a8b04e1cSUlrich Weigand // Count trailing zeros. 5368010b631SJonas Paulsson def VCTZ : UnaryVRRaGeneric<"vctz", 0xE752>; 537ce4c1095SUlrich Weigand def VCTZB : UnaryVRRa<"vctzb", 0xE752, cttz, v128b, v128b, 0>; 538ce4c1095SUlrich Weigand def VCTZH : UnaryVRRa<"vctzh", 0xE752, cttz, v128h, v128h, 1>; 539ce4c1095SUlrich Weigand def VCTZF : UnaryVRRa<"vctzf", 0xE752, cttz, v128f, v128f, 2>; 540ce4c1095SUlrich Weigand def VCTZG : UnaryVRRa<"vctzg", 0xE752, cttz, v128g, v128g, 3>; 541a8b04e1cSUlrich Weigand 5427e02da7dSJonas Paulsson let isCommutable = 1 in { 5432b3482feSUlrich Weigand // Not exclusive or. 5442b3482feSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in 5452b3482feSUlrich Weigand def VNX : BinaryVRRc<"vnx", 0xE76C, null_frag, v128any, v128any>; 5462b3482feSUlrich Weigand 547a8b04e1cSUlrich Weigand // Exclusive or. 548a8b04e1cSUlrich Weigand def VX : BinaryVRRc<"vx", 0xE76D, null_frag, v128any, v128any>; 5497e02da7dSJonas Paulsson } 550a8b04e1cSUlrich Weigand 551a8b04e1cSUlrich Weigand // Galois field multiply sum. 5526e31ab38SUlrich Weigand def VGFM : BinaryVRRcGeneric<"vgfm", 0xE7B4>; 553c1708b26SUlrich Weigand def VGFMB : BinaryVRRc<"vgfmb", 0xE7B4, int_s390_vgfmb, v128h, v128b, 0>; 554c1708b26SUlrich Weigand def VGFMH : BinaryVRRc<"vgfmh", 0xE7B4, int_s390_vgfmh, v128f, v128h, 1>; 555c1708b26SUlrich Weigand def VGFMF : BinaryVRRc<"vgfmf", 0xE7B4, int_s390_vgfmf, v128g, v128f, 2>; 556c1708b26SUlrich Weigand def VGFMG : BinaryVRRc<"vgfmg", 0xE7B4, int_s390_vgfmg, v128q, v128g, 3>; 557a8b04e1cSUlrich Weigand 558a8b04e1cSUlrich Weigand // Galois field multiply sum and accumulate. 5596e31ab38SUlrich Weigand def VGFMA : TernaryVRRdGeneric<"vgfma", 0xE7BC>; 560c1708b26SUlrich Weigand def VGFMAB : TernaryVRRd<"vgfmab", 0xE7BC, int_s390_vgfmab, v128h, v128b, 0>; 561c1708b26SUlrich Weigand def VGFMAH : TernaryVRRd<"vgfmah", 0xE7BC, int_s390_vgfmah, v128f, v128h, 1>; 562c1708b26SUlrich Weigand def VGFMAF : TernaryVRRd<"vgfmaf", 0xE7BC, int_s390_vgfmaf, v128g, v128f, 2>; 563c1708b26SUlrich Weigand def VGFMAG : TernaryVRRd<"vgfmag", 0xE7BC, int_s390_vgfmag, v128q, v128g, 3>; 564a8b04e1cSUlrich Weigand 565a8b04e1cSUlrich Weigand // Load complement. 5666e31ab38SUlrich Weigand def VLC : UnaryVRRaGeneric<"vlc", 0xE7DE>; 567ce4c1095SUlrich Weigand def VLCB : UnaryVRRa<"vlcb", 0xE7DE, z_vneg, v128b, v128b, 0>; 568ce4c1095SUlrich Weigand def VLCH : UnaryVRRa<"vlch", 0xE7DE, z_vneg, v128h, v128h, 1>; 569ce4c1095SUlrich Weigand def VLCF : UnaryVRRa<"vlcf", 0xE7DE, z_vneg, v128f, v128f, 2>; 570ce4c1095SUlrich Weigand def VLCG : UnaryVRRa<"vlcg", 0xE7DE, z_vneg, v128g, v128g, 3>; 571a8b04e1cSUlrich Weigand 572a8b04e1cSUlrich Weigand // Load positive. 5736e31ab38SUlrich Weigand def VLP : UnaryVRRaGeneric<"vlp", 0xE7DF>; 57445b8e37aSJonas Paulsson def VLPB : UnaryVRRa<"vlpb", 0xE7DF, abs, v128b, v128b, 0>; 57545b8e37aSJonas Paulsson def VLPH : UnaryVRRa<"vlph", 0xE7DF, abs, v128h, v128h, 1>; 57645b8e37aSJonas Paulsson def VLPF : UnaryVRRa<"vlpf", 0xE7DF, abs, v128f, v128f, 2>; 57745b8e37aSJonas Paulsson def VLPG : UnaryVRRa<"vlpg", 0xE7DF, abs, v128g, v128g, 3>; 578a8b04e1cSUlrich Weigand 5797e02da7dSJonas Paulsson let isCommutable = 1 in { 580a8b04e1cSUlrich Weigand // Maximum. 5816e31ab38SUlrich Weigand def VMX : BinaryVRRcGeneric<"vmx", 0xE7FF>; 582a8b04e1cSUlrich Weigand def VMXB : BinaryVRRc<"vmxb", 0xE7FF, null_frag, v128b, v128b, 0>; 583a8b04e1cSUlrich Weigand def VMXH : BinaryVRRc<"vmxh", 0xE7FF, null_frag, v128h, v128h, 1>; 584a8b04e1cSUlrich Weigand def VMXF : BinaryVRRc<"vmxf", 0xE7FF, null_frag, v128f, v128f, 2>; 585a8b04e1cSUlrich Weigand def VMXG : BinaryVRRc<"vmxg", 0xE7FF, null_frag, v128g, v128g, 3>; 586a8b04e1cSUlrich Weigand 587a8b04e1cSUlrich Weigand // Maximum logical. 5886e31ab38SUlrich Weigand def VMXL : BinaryVRRcGeneric<"vmxl", 0xE7FD>; 589a8b04e1cSUlrich Weigand def VMXLB : BinaryVRRc<"vmxlb", 0xE7FD, null_frag, v128b, v128b, 0>; 590a8b04e1cSUlrich Weigand def VMXLH : BinaryVRRc<"vmxlh", 0xE7FD, null_frag, v128h, v128h, 1>; 591a8b04e1cSUlrich Weigand def VMXLF : BinaryVRRc<"vmxlf", 0xE7FD, null_frag, v128f, v128f, 2>; 592a8b04e1cSUlrich Weigand def VMXLG : BinaryVRRc<"vmxlg", 0xE7FD, null_frag, v128g, v128g, 3>; 5937e02da7dSJonas Paulsson } 594a8b04e1cSUlrich Weigand 5957e02da7dSJonas Paulsson let isCommutable = 1 in { 596a8b04e1cSUlrich Weigand // Minimum. 5976e31ab38SUlrich Weigand def VMN : BinaryVRRcGeneric<"vmn", 0xE7FE>; 598a8b04e1cSUlrich Weigand def VMNB : BinaryVRRc<"vmnb", 0xE7FE, null_frag, v128b, v128b, 0>; 599a8b04e1cSUlrich Weigand def VMNH : BinaryVRRc<"vmnh", 0xE7FE, null_frag, v128h, v128h, 1>; 600a8b04e1cSUlrich Weigand def VMNF : BinaryVRRc<"vmnf", 0xE7FE, null_frag, v128f, v128f, 2>; 601a8b04e1cSUlrich Weigand def VMNG : BinaryVRRc<"vmng", 0xE7FE, null_frag, v128g, v128g, 3>; 602a8b04e1cSUlrich Weigand 603a8b04e1cSUlrich Weigand // Minimum logical. 6046e31ab38SUlrich Weigand def VMNL : BinaryVRRcGeneric<"vmnl", 0xE7FC>; 605a8b04e1cSUlrich Weigand def VMNLB : BinaryVRRc<"vmnlb", 0xE7FC, null_frag, v128b, v128b, 0>; 606a8b04e1cSUlrich Weigand def VMNLH : BinaryVRRc<"vmnlh", 0xE7FC, null_frag, v128h, v128h, 1>; 607a8b04e1cSUlrich Weigand def VMNLF : BinaryVRRc<"vmnlf", 0xE7FC, null_frag, v128f, v128f, 2>; 608a8b04e1cSUlrich Weigand def VMNLG : BinaryVRRc<"vmnlg", 0xE7FC, null_frag, v128g, v128g, 3>; 6097e02da7dSJonas Paulsson } 610a8b04e1cSUlrich Weigand 6117e02da7dSJonas Paulsson let isCommutable = 1 in { 612a8b04e1cSUlrich Weigand // Multiply and add low. 6136e31ab38SUlrich Weigand def VMAL : TernaryVRRdGeneric<"vmal", 0xE7AA>; 614ce4c1095SUlrich Weigand def VMALB : TernaryVRRd<"vmalb", 0xE7AA, z_muladd, v128b, v128b, 0>; 615ce4c1095SUlrich Weigand def VMALHW : TernaryVRRd<"vmalhw", 0xE7AA, z_muladd, v128h, v128h, 1>; 616ce4c1095SUlrich Weigand def VMALF : TernaryVRRd<"vmalf", 0xE7AA, z_muladd, v128f, v128f, 2>; 617a8b04e1cSUlrich Weigand 618a8b04e1cSUlrich Weigand // Multiply and add high. 6196e31ab38SUlrich Weigand def VMAH : TernaryVRRdGeneric<"vmah", 0xE7AB>; 620c1708b26SUlrich Weigand def VMAHB : TernaryVRRd<"vmahb", 0xE7AB, int_s390_vmahb, v128b, v128b, 0>; 621c1708b26SUlrich Weigand def VMAHH : TernaryVRRd<"vmahh", 0xE7AB, int_s390_vmahh, v128h, v128h, 1>; 622c1708b26SUlrich Weigand def VMAHF : TernaryVRRd<"vmahf", 0xE7AB, int_s390_vmahf, v128f, v128f, 2>; 623a8b04e1cSUlrich Weigand 624a8b04e1cSUlrich Weigand // Multiply and add logical high. 6256e31ab38SUlrich Weigand def VMALH : TernaryVRRdGeneric<"vmalh", 0xE7A9>; 626c1708b26SUlrich Weigand def VMALHB : TernaryVRRd<"vmalhb", 0xE7A9, int_s390_vmalhb, v128b, v128b, 0>; 627c1708b26SUlrich Weigand def VMALHH : TernaryVRRd<"vmalhh", 0xE7A9, int_s390_vmalhh, v128h, v128h, 1>; 628c1708b26SUlrich Weigand def VMALHF : TernaryVRRd<"vmalhf", 0xE7A9, int_s390_vmalhf, v128f, v128f, 2>; 629a8b04e1cSUlrich Weigand 630a8b04e1cSUlrich Weigand // Multiply and add even. 6316e31ab38SUlrich Weigand def VMAE : TernaryVRRdGeneric<"vmae", 0xE7AE>; 632c1708b26SUlrich Weigand def VMAEB : TernaryVRRd<"vmaeb", 0xE7AE, int_s390_vmaeb, v128h, v128b, 0>; 633c1708b26SUlrich Weigand def VMAEH : TernaryVRRd<"vmaeh", 0xE7AE, int_s390_vmaeh, v128f, v128h, 1>; 634c1708b26SUlrich Weigand def VMAEF : TernaryVRRd<"vmaef", 0xE7AE, int_s390_vmaef, v128g, v128f, 2>; 635a8b04e1cSUlrich Weigand 636a8b04e1cSUlrich Weigand // Multiply and add logical even. 6376e31ab38SUlrich Weigand def VMALE : TernaryVRRdGeneric<"vmale", 0xE7AC>; 638c1708b26SUlrich Weigand def VMALEB : TernaryVRRd<"vmaleb", 0xE7AC, int_s390_vmaleb, v128h, v128b, 0>; 639c1708b26SUlrich Weigand def VMALEH : TernaryVRRd<"vmaleh", 0xE7AC, int_s390_vmaleh, v128f, v128h, 1>; 640c1708b26SUlrich Weigand def VMALEF : TernaryVRRd<"vmalef", 0xE7AC, int_s390_vmalef, v128g, v128f, 2>; 641a8b04e1cSUlrich Weigand 642a8b04e1cSUlrich Weigand // Multiply and add odd. 6436e31ab38SUlrich Weigand def VMAO : TernaryVRRdGeneric<"vmao", 0xE7AF>; 644c1708b26SUlrich Weigand def VMAOB : TernaryVRRd<"vmaob", 0xE7AF, int_s390_vmaob, v128h, v128b, 0>; 645c1708b26SUlrich Weigand def VMAOH : TernaryVRRd<"vmaoh", 0xE7AF, int_s390_vmaoh, v128f, v128h, 1>; 646c1708b26SUlrich Weigand def VMAOF : TernaryVRRd<"vmaof", 0xE7AF, int_s390_vmaof, v128g, v128f, 2>; 647a8b04e1cSUlrich Weigand 648a8b04e1cSUlrich Weigand // Multiply and add logical odd. 6496e31ab38SUlrich Weigand def VMALO : TernaryVRRdGeneric<"vmalo", 0xE7AD>; 650c1708b26SUlrich Weigand def VMALOB : TernaryVRRd<"vmalob", 0xE7AD, int_s390_vmalob, v128h, v128b, 0>; 651c1708b26SUlrich Weigand def VMALOH : TernaryVRRd<"vmaloh", 0xE7AD, int_s390_vmaloh, v128f, v128h, 1>; 652c1708b26SUlrich Weigand def VMALOF : TernaryVRRd<"vmalof", 0xE7AD, int_s390_vmalof, v128g, v128f, 2>; 6537e02da7dSJonas Paulsson } 654a8b04e1cSUlrich Weigand 6557e02da7dSJonas Paulsson let isCommutable = 1 in { 656a8b04e1cSUlrich Weigand // Multiply high. 6576e31ab38SUlrich Weigand def VMH : BinaryVRRcGeneric<"vmh", 0xE7A3>; 658c1708b26SUlrich Weigand def VMHB : BinaryVRRc<"vmhb", 0xE7A3, int_s390_vmhb, v128b, v128b, 0>; 659c1708b26SUlrich Weigand def VMHH : BinaryVRRc<"vmhh", 0xE7A3, int_s390_vmhh, v128h, v128h, 1>; 660c1708b26SUlrich Weigand def VMHF : BinaryVRRc<"vmhf", 0xE7A3, int_s390_vmhf, v128f, v128f, 2>; 661a8b04e1cSUlrich Weigand 662a8b04e1cSUlrich Weigand // Multiply logical high. 6636e31ab38SUlrich Weigand def VMLH : BinaryVRRcGeneric<"vmlh", 0xE7A1>; 664c1708b26SUlrich Weigand def VMLHB : BinaryVRRc<"vmlhb", 0xE7A1, int_s390_vmlhb, v128b, v128b, 0>; 665c1708b26SUlrich Weigand def VMLHH : BinaryVRRc<"vmlhh", 0xE7A1, int_s390_vmlhh, v128h, v128h, 1>; 666c1708b26SUlrich Weigand def VMLHF : BinaryVRRc<"vmlhf", 0xE7A1, int_s390_vmlhf, v128f, v128f, 2>; 667a8b04e1cSUlrich Weigand 668a8b04e1cSUlrich Weigand // Multiply low. 6696e31ab38SUlrich Weigand def VML : BinaryVRRcGeneric<"vml", 0xE7A2>; 670ce4c1095SUlrich Weigand def VMLB : BinaryVRRc<"vmlb", 0xE7A2, mul, v128b, v128b, 0>; 671ce4c1095SUlrich Weigand def VMLHW : BinaryVRRc<"vmlhw", 0xE7A2, mul, v128h, v128h, 1>; 672ce4c1095SUlrich Weigand def VMLF : BinaryVRRc<"vmlf", 0xE7A2, mul, v128f, v128f, 2>; 673a8b04e1cSUlrich Weigand 674a8b04e1cSUlrich Weigand // Multiply even. 6756e31ab38SUlrich Weigand def VME : BinaryVRRcGeneric<"vme", 0xE7A6>; 676c1708b26SUlrich Weigand def VMEB : BinaryVRRc<"vmeb", 0xE7A6, int_s390_vmeb, v128h, v128b, 0>; 677c1708b26SUlrich Weigand def VMEH : BinaryVRRc<"vmeh", 0xE7A6, int_s390_vmeh, v128f, v128h, 1>; 678c1708b26SUlrich Weigand def VMEF : BinaryVRRc<"vmef", 0xE7A6, int_s390_vmef, v128g, v128f, 2>; 679a8b04e1cSUlrich Weigand 680a8b04e1cSUlrich Weigand // Multiply logical even. 6816e31ab38SUlrich Weigand def VMLE : BinaryVRRcGeneric<"vmle", 0xE7A4>; 682c1708b26SUlrich Weigand def VMLEB : BinaryVRRc<"vmleb", 0xE7A4, int_s390_vmleb, v128h, v128b, 0>; 683c1708b26SUlrich Weigand def VMLEH : BinaryVRRc<"vmleh", 0xE7A4, int_s390_vmleh, v128f, v128h, 1>; 684c1708b26SUlrich Weigand def VMLEF : BinaryVRRc<"vmlef", 0xE7A4, int_s390_vmlef, v128g, v128f, 2>; 685a8b04e1cSUlrich Weigand 686a8b04e1cSUlrich Weigand // Multiply odd. 6876e31ab38SUlrich Weigand def VMO : BinaryVRRcGeneric<"vmo", 0xE7A7>; 688c1708b26SUlrich Weigand def VMOB : BinaryVRRc<"vmob", 0xE7A7, int_s390_vmob, v128h, v128b, 0>; 689c1708b26SUlrich Weigand def VMOH : BinaryVRRc<"vmoh", 0xE7A7, int_s390_vmoh, v128f, v128h, 1>; 690c1708b26SUlrich Weigand def VMOF : BinaryVRRc<"vmof", 0xE7A7, int_s390_vmof, v128g, v128f, 2>; 691a8b04e1cSUlrich Weigand 692a8b04e1cSUlrich Weigand // Multiply logical odd. 6936e31ab38SUlrich Weigand def VMLO : BinaryVRRcGeneric<"vmlo", 0xE7A5>; 694c1708b26SUlrich Weigand def VMLOB : BinaryVRRc<"vmlob", 0xE7A5, int_s390_vmlob, v128h, v128b, 0>; 695c1708b26SUlrich Weigand def VMLOH : BinaryVRRc<"vmloh", 0xE7A5, int_s390_vmloh, v128f, v128h, 1>; 696c1708b26SUlrich Weigand def VMLOF : BinaryVRRc<"vmlof", 0xE7A5, int_s390_vmlof, v128g, v128f, 2>; 6977e02da7dSJonas Paulsson } 698a8b04e1cSUlrich Weigand 6992b3482feSUlrich Weigand // Multiply sum logical. 7007e02da7dSJonas Paulsson let Predicates = [FeatureVectorEnhancements1], isCommutable = 1 in { 7012b3482feSUlrich Weigand def VMSL : QuaternaryVRRdGeneric<"vmsl", 0xE7B8>; 7022b3482feSUlrich Weigand def VMSLG : QuaternaryVRRd<"vmslg", 0xE7B8, int_s390_vmslg, 7032b3482feSUlrich Weigand v128q, v128g, v128g, v128q, 3>; 7042b3482feSUlrich Weigand } 7052b3482feSUlrich Weigand 7062b3482feSUlrich Weigand // Nand. 7077e02da7dSJonas Paulsson let Predicates = [FeatureVectorEnhancements1], isCommutable = 1 in 7082b3482feSUlrich Weigand def VNN : BinaryVRRc<"vnn", 0xE76E, null_frag, v128any, v128any>; 7092b3482feSUlrich Weigand 710a8b04e1cSUlrich Weigand // Nor. 7117e02da7dSJonas Paulsson let isCommutable = 1 in 712a8b04e1cSUlrich Weigand def VNO : BinaryVRRc<"vno", 0xE76B, null_frag, v128any, v128any>; 7136e31ab38SUlrich Weigand def : InstAlias<"vnot\t$V1, $V2", (VNO VR128:$V1, VR128:$V2, VR128:$V2), 0>; 714a8b04e1cSUlrich Weigand 715a8b04e1cSUlrich Weigand // Or. 7167e02da7dSJonas Paulsson let isCommutable = 1 in 717a8b04e1cSUlrich Weigand def VO : BinaryVRRc<"vo", 0xE76A, null_frag, v128any, v128any>; 718a8b04e1cSUlrich Weigand 7192b3482feSUlrich Weigand // Or with complement. 7202b3482feSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in 7212b3482feSUlrich Weigand def VOC : BinaryVRRc<"voc", 0xE76F, null_frag, v128any, v128any>; 7222b3482feSUlrich Weigand 723a8b04e1cSUlrich Weigand // Population count. 7246e31ab38SUlrich Weigand def VPOPCT : UnaryVRRaGeneric<"vpopct", 0xE750>; 725ce4c1095SUlrich Weigand def : Pat<(v16i8 (z_popcnt VR128:$x)), (VPOPCT VR128:$x, 0)>; 7262b3482feSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in { 7272b3482feSUlrich Weigand def VPOPCTB : UnaryVRRa<"vpopctb", 0xE750, ctpop, v128b, v128b, 0>; 7282b3482feSUlrich Weigand def VPOPCTH : UnaryVRRa<"vpopcth", 0xE750, ctpop, v128h, v128h, 1>; 7292b3482feSUlrich Weigand def VPOPCTF : UnaryVRRa<"vpopctf", 0xE750, ctpop, v128f, v128f, 2>; 7302b3482feSUlrich Weigand def VPOPCTG : UnaryVRRa<"vpopctg", 0xE750, ctpop, v128g, v128g, 3>; 7312b3482feSUlrich Weigand } 732a8b04e1cSUlrich Weigand 733a8b04e1cSUlrich Weigand // Element rotate left logical (with vector shift amount). 7346e31ab38SUlrich Weigand def VERLLV : BinaryVRRcGeneric<"verllv", 0xE773>; 735c1708b26SUlrich Weigand def VERLLVB : BinaryVRRc<"verllvb", 0xE773, int_s390_verllvb, 736c1708b26SUlrich Weigand v128b, v128b, 0>; 737c1708b26SUlrich Weigand def VERLLVH : BinaryVRRc<"verllvh", 0xE773, int_s390_verllvh, 738c1708b26SUlrich Weigand v128h, v128h, 1>; 739c1708b26SUlrich Weigand def VERLLVF : BinaryVRRc<"verllvf", 0xE773, int_s390_verllvf, 740c1708b26SUlrich Weigand v128f, v128f, 2>; 741c1708b26SUlrich Weigand def VERLLVG : BinaryVRRc<"verllvg", 0xE773, int_s390_verllvg, 742c1708b26SUlrich Weigand v128g, v128g, 3>; 743a8b04e1cSUlrich Weigand 744a8b04e1cSUlrich Weigand // Element rotate left logical (with scalar shift amount). 7456e31ab38SUlrich Weigand def VERLL : BinaryVRSaGeneric<"verll", 0xE733>; 746c1708b26SUlrich Weigand def VERLLB : BinaryVRSa<"verllb", 0xE733, int_s390_verllb, v128b, v128b, 0>; 747c1708b26SUlrich Weigand def VERLLH : BinaryVRSa<"verllh", 0xE733, int_s390_verllh, v128h, v128h, 1>; 748c1708b26SUlrich Weigand def VERLLF : BinaryVRSa<"verllf", 0xE733, int_s390_verllf, v128f, v128f, 2>; 749c1708b26SUlrich Weigand def VERLLG : BinaryVRSa<"verllg", 0xE733, int_s390_verllg, v128g, v128g, 3>; 750a8b04e1cSUlrich Weigand 751a8b04e1cSUlrich Weigand // Element rotate and insert under mask. 7526e31ab38SUlrich Weigand def VERIM : QuaternaryVRIdGeneric<"verim", 0xE772>; 753c1708b26SUlrich Weigand def VERIMB : QuaternaryVRId<"verimb", 0xE772, int_s390_verimb, v128b, v128b, 0>; 754c1708b26SUlrich Weigand def VERIMH : QuaternaryVRId<"verimh", 0xE772, int_s390_verimh, v128h, v128h, 1>; 755c1708b26SUlrich Weigand def VERIMF : QuaternaryVRId<"verimf", 0xE772, int_s390_verimf, v128f, v128f, 2>; 756c1708b26SUlrich Weigand def VERIMG : QuaternaryVRId<"verimg", 0xE772, int_s390_verimg, v128g, v128g, 3>; 757a8b04e1cSUlrich Weigand 758a8b04e1cSUlrich Weigand // Element shift left (with vector shift amount). 7596e31ab38SUlrich Weigand def VESLV : BinaryVRRcGeneric<"veslv", 0xE770>; 760ce4c1095SUlrich Weigand def VESLVB : BinaryVRRc<"veslvb", 0xE770, z_vshl, v128b, v128b, 0>; 761ce4c1095SUlrich Weigand def VESLVH : BinaryVRRc<"veslvh", 0xE770, z_vshl, v128h, v128h, 1>; 762ce4c1095SUlrich Weigand def VESLVF : BinaryVRRc<"veslvf", 0xE770, z_vshl, v128f, v128f, 2>; 763ce4c1095SUlrich Weigand def VESLVG : BinaryVRRc<"veslvg", 0xE770, z_vshl, v128g, v128g, 3>; 764a8b04e1cSUlrich Weigand 765a8b04e1cSUlrich Weigand // Element shift left (with scalar shift amount). 7666e31ab38SUlrich Weigand def VESL : BinaryVRSaGeneric<"vesl", 0xE730>; 767ce4c1095SUlrich Weigand def VESLB : BinaryVRSa<"veslb", 0xE730, z_vshl_by_scalar, v128b, v128b, 0>; 768ce4c1095SUlrich Weigand def VESLH : BinaryVRSa<"veslh", 0xE730, z_vshl_by_scalar, v128h, v128h, 1>; 769ce4c1095SUlrich Weigand def VESLF : BinaryVRSa<"veslf", 0xE730, z_vshl_by_scalar, v128f, v128f, 2>; 770ce4c1095SUlrich Weigand def VESLG : BinaryVRSa<"veslg", 0xE730, z_vshl_by_scalar, v128g, v128g, 3>; 771a8b04e1cSUlrich Weigand 772a8b04e1cSUlrich Weigand // Element shift right arithmetic (with vector shift amount). 7736e31ab38SUlrich Weigand def VESRAV : BinaryVRRcGeneric<"vesrav", 0xE77A>; 774ce4c1095SUlrich Weigand def VESRAVB : BinaryVRRc<"vesravb", 0xE77A, z_vsra, v128b, v128b, 0>; 775ce4c1095SUlrich Weigand def VESRAVH : BinaryVRRc<"vesravh", 0xE77A, z_vsra, v128h, v128h, 1>; 776ce4c1095SUlrich Weigand def VESRAVF : BinaryVRRc<"vesravf", 0xE77A, z_vsra, v128f, v128f, 2>; 777ce4c1095SUlrich Weigand def VESRAVG : BinaryVRRc<"vesravg", 0xE77A, z_vsra, v128g, v128g, 3>; 778a8b04e1cSUlrich Weigand 779a8b04e1cSUlrich Weigand // Element shift right arithmetic (with scalar shift amount). 7806e31ab38SUlrich Weigand def VESRA : BinaryVRSaGeneric<"vesra", 0xE73A>; 781ce4c1095SUlrich Weigand def VESRAB : BinaryVRSa<"vesrab", 0xE73A, z_vsra_by_scalar, v128b, v128b, 0>; 782ce4c1095SUlrich Weigand def VESRAH : BinaryVRSa<"vesrah", 0xE73A, z_vsra_by_scalar, v128h, v128h, 1>; 783ce4c1095SUlrich Weigand def VESRAF : BinaryVRSa<"vesraf", 0xE73A, z_vsra_by_scalar, v128f, v128f, 2>; 784ce4c1095SUlrich Weigand def VESRAG : BinaryVRSa<"vesrag", 0xE73A, z_vsra_by_scalar, v128g, v128g, 3>; 785a8b04e1cSUlrich Weigand 786a8b04e1cSUlrich Weigand // Element shift right logical (with vector shift amount). 7876e31ab38SUlrich Weigand def VESRLV : BinaryVRRcGeneric<"vesrlv", 0xE778>; 788ce4c1095SUlrich Weigand def VESRLVB : BinaryVRRc<"vesrlvb", 0xE778, z_vsrl, v128b, v128b, 0>; 789ce4c1095SUlrich Weigand def VESRLVH : BinaryVRRc<"vesrlvh", 0xE778, z_vsrl, v128h, v128h, 1>; 790ce4c1095SUlrich Weigand def VESRLVF : BinaryVRRc<"vesrlvf", 0xE778, z_vsrl, v128f, v128f, 2>; 791ce4c1095SUlrich Weigand def VESRLVG : BinaryVRRc<"vesrlvg", 0xE778, z_vsrl, v128g, v128g, 3>; 792a8b04e1cSUlrich Weigand 793a8b04e1cSUlrich Weigand // Element shift right logical (with scalar shift amount). 7946e31ab38SUlrich Weigand def VESRL : BinaryVRSaGeneric<"vesrl", 0xE738>; 795ce4c1095SUlrich Weigand def VESRLB : BinaryVRSa<"vesrlb", 0xE738, z_vsrl_by_scalar, v128b, v128b, 0>; 796ce4c1095SUlrich Weigand def VESRLH : BinaryVRSa<"vesrlh", 0xE738, z_vsrl_by_scalar, v128h, v128h, 1>; 797ce4c1095SUlrich Weigand def VESRLF : BinaryVRSa<"vesrlf", 0xE738, z_vsrl_by_scalar, v128f, v128f, 2>; 798ce4c1095SUlrich Weigand def VESRLG : BinaryVRSa<"vesrlg", 0xE738, z_vsrl_by_scalar, v128g, v128g, 3>; 799a8b04e1cSUlrich Weigand 800a8b04e1cSUlrich Weigand // Shift left. 801c1708b26SUlrich Weigand def VSL : BinaryVRRc<"vsl", 0xE774, int_s390_vsl, v128b, v128b>; 802a8b04e1cSUlrich Weigand 803a8b04e1cSUlrich Weigand // Shift left by byte. 804c1708b26SUlrich Weigand def VSLB : BinaryVRRc<"vslb", 0xE775, int_s390_vslb, v128b, v128b>; 805a8b04e1cSUlrich Weigand 806a8b04e1cSUlrich Weigand // Shift left double by byte. 807ce4c1095SUlrich Weigand def VSLDB : TernaryVRId<"vsldb", 0xE777, z_shl_double, v128b, v128b, 0>; 8083ecab8e4SMatt Arsenault def : Pat<(int_s390_vsldb VR128:$x, VR128:$y, imm32zx8_timm:$z), 809c1708b26SUlrich Weigand (VSLDB VR128:$x, VR128:$y, imm32zx8:$z)>; 810a8b04e1cSUlrich Weigand 8110f0a8b77SUlrich Weigand // Shift left double by bit. 8120f0a8b77SUlrich Weigand let Predicates = [FeatureVectorEnhancements2] in 8130f0a8b77SUlrich Weigand def VSLD : TernaryVRId<"vsld", 0xE786, int_s390_vsld, v128b, v128b, 0>; 8140f0a8b77SUlrich Weigand 815a8b04e1cSUlrich Weigand // Shift right arithmetic. 816c1708b26SUlrich Weigand def VSRA : BinaryVRRc<"vsra", 0xE77E, int_s390_vsra, v128b, v128b>; 817a8b04e1cSUlrich Weigand 818a8b04e1cSUlrich Weigand // Shift right arithmetic by byte. 819c1708b26SUlrich Weigand def VSRAB : BinaryVRRc<"vsrab", 0xE77F, int_s390_vsrab, v128b, v128b>; 820a8b04e1cSUlrich Weigand 821a8b04e1cSUlrich Weigand // Shift right logical. 822c1708b26SUlrich Weigand def VSRL : BinaryVRRc<"vsrl", 0xE77C, int_s390_vsrl, v128b, v128b>; 823a8b04e1cSUlrich Weigand 824a8b04e1cSUlrich Weigand // Shift right logical by byte. 825c1708b26SUlrich Weigand def VSRLB : BinaryVRRc<"vsrlb", 0xE77D, int_s390_vsrlb, v128b, v128b>; 826a8b04e1cSUlrich Weigand 8270f0a8b77SUlrich Weigand // Shift right double by bit. 8280f0a8b77SUlrich Weigand let Predicates = [FeatureVectorEnhancements2] in 8290f0a8b77SUlrich Weigand def VSRD : TernaryVRId<"vsrd", 0xE787, int_s390_vsrd, v128b, v128b, 0>; 8300f0a8b77SUlrich Weigand 831a8b04e1cSUlrich Weigand // Subtract. 8326e31ab38SUlrich Weigand def VS : BinaryVRRcGeneric<"vs", 0xE7F7>; 833ce4c1095SUlrich Weigand def VSB : BinaryVRRc<"vsb", 0xE7F7, sub, v128b, v128b, 0>; 834ce4c1095SUlrich Weigand def VSH : BinaryVRRc<"vsh", 0xE7F7, sub, v128h, v128h, 1>; 835ce4c1095SUlrich Weigand def VSF : BinaryVRRc<"vsf", 0xE7F7, sub, v128f, v128f, 2>; 836ce4c1095SUlrich Weigand def VSG : BinaryVRRc<"vsg", 0xE7F7, sub, v128g, v128g, 3>; 837c1708b26SUlrich Weigand def VSQ : BinaryVRRc<"vsq", 0xE7F7, int_s390_vsq, v128q, v128q, 4>; 838a8b04e1cSUlrich Weigand 839a8b04e1cSUlrich Weigand // Subtract compute borrow indication. 8406e31ab38SUlrich Weigand def VSCBI : BinaryVRRcGeneric<"vscbi", 0xE7F5>; 841c1708b26SUlrich Weigand def VSCBIB : BinaryVRRc<"vscbib", 0xE7F5, int_s390_vscbib, v128b, v128b, 0>; 842c1708b26SUlrich Weigand def VSCBIH : BinaryVRRc<"vscbih", 0xE7F5, int_s390_vscbih, v128h, v128h, 1>; 843c1708b26SUlrich Weigand def VSCBIF : BinaryVRRc<"vscbif", 0xE7F5, int_s390_vscbif, v128f, v128f, 2>; 844c1708b26SUlrich Weigand def VSCBIG : BinaryVRRc<"vscbig", 0xE7F5, int_s390_vscbig, v128g, v128g, 3>; 845c1708b26SUlrich Weigand def VSCBIQ : BinaryVRRc<"vscbiq", 0xE7F5, int_s390_vscbiq, v128q, v128q, 4>; 846a8b04e1cSUlrich Weigand 847a8b04e1cSUlrich Weigand // Subtract with borrow indication. 8486e31ab38SUlrich Weigand def VSBI : TernaryVRRdGeneric<"vsbi", 0xE7BF>; 849c1708b26SUlrich Weigand def VSBIQ : TernaryVRRd<"vsbiq", 0xE7BF, int_s390_vsbiq, v128q, v128q, 4>; 850a8b04e1cSUlrich Weigand 851a8b04e1cSUlrich Weigand // Subtract with borrow compute borrow indication. 8526e31ab38SUlrich Weigand def VSBCBI : TernaryVRRdGeneric<"vsbcbi", 0xE7BD>; 853c1708b26SUlrich Weigand def VSBCBIQ : TernaryVRRd<"vsbcbiq", 0xE7BD, int_s390_vsbcbiq, 854c1708b26SUlrich Weigand v128q, v128q, 4>; 855a8b04e1cSUlrich Weigand 856a8b04e1cSUlrich Weigand // Sum across doubleword. 8576e31ab38SUlrich Weigand def VSUMG : BinaryVRRcGeneric<"vsumg", 0xE765>; 858ce4c1095SUlrich Weigand def VSUMGH : BinaryVRRc<"vsumgh", 0xE765, z_vsum, v128g, v128h, 1>; 859ce4c1095SUlrich Weigand def VSUMGF : BinaryVRRc<"vsumgf", 0xE765, z_vsum, v128g, v128f, 2>; 860a8b04e1cSUlrich Weigand 861a8b04e1cSUlrich Weigand // Sum across quadword. 8626e31ab38SUlrich Weigand def VSUMQ : BinaryVRRcGeneric<"vsumq", 0xE767>; 863ce4c1095SUlrich Weigand def VSUMQF : BinaryVRRc<"vsumqf", 0xE767, z_vsum, v128q, v128f, 2>; 864ce4c1095SUlrich Weigand def VSUMQG : BinaryVRRc<"vsumqg", 0xE767, z_vsum, v128q, v128g, 3>; 865a8b04e1cSUlrich Weigand 866a8b04e1cSUlrich Weigand // Sum across word. 8676e31ab38SUlrich Weigand def VSUM : BinaryVRRcGeneric<"vsum", 0xE764>; 868ce4c1095SUlrich Weigand def VSUMB : BinaryVRRc<"vsumb", 0xE764, z_vsum, v128f, v128b, 0>; 869ce4c1095SUlrich Weigand def VSUMH : BinaryVRRc<"vsumh", 0xE764, z_vsum, v128f, v128h, 1>; 870a8b04e1cSUlrich Weigand} 871a8b04e1cSUlrich Weigand 872ce4c1095SUlrich Weigand// Instantiate the bitwise ops for type TYPE. 873ce4c1095SUlrich Weigandmulticlass BitwiseVectorOps<ValueType type> { 874ce4c1095SUlrich Weigand let Predicates = [FeatureVector] in { 875ce4c1095SUlrich Weigand def : Pat<(type (and VR128:$x, VR128:$y)), (VN VR128:$x, VR128:$y)>; 876ce4c1095SUlrich Weigand def : Pat<(type (and VR128:$x, (z_vnot VR128:$y))), 877ce4c1095SUlrich Weigand (VNC VR128:$x, VR128:$y)>; 878ce4c1095SUlrich Weigand def : Pat<(type (or VR128:$x, VR128:$y)), (VO VR128:$x, VR128:$y)>; 879ce4c1095SUlrich Weigand def : Pat<(type (xor VR128:$x, VR128:$y)), (VX VR128:$x, VR128:$y)>; 880ce4c1095SUlrich Weigand def : Pat<(type (or (and VR128:$x, VR128:$z), 881ce4c1095SUlrich Weigand (and VR128:$y, (z_vnot VR128:$z)))), 882ce4c1095SUlrich Weigand (VSEL VR128:$x, VR128:$y, VR128:$z)>; 883ce4c1095SUlrich Weigand def : Pat<(type (z_vnot (or VR128:$x, VR128:$y))), 884ce4c1095SUlrich Weigand (VNO VR128:$x, VR128:$y)>; 885ce4c1095SUlrich Weigand def : Pat<(type (z_vnot VR128:$x)), (VNO VR128:$x, VR128:$x)>; 886ce4c1095SUlrich Weigand } 8872b3482feSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in { 8882b3482feSUlrich Weigand def : Pat<(type (z_vnot (xor VR128:$x, VR128:$y))), 8892b3482feSUlrich Weigand (VNX VR128:$x, VR128:$y)>; 8902b3482feSUlrich Weigand def : Pat<(type (z_vnot (and VR128:$x, VR128:$y))), 8912b3482feSUlrich Weigand (VNN VR128:$x, VR128:$y)>; 8922b3482feSUlrich Weigand def : Pat<(type (or VR128:$x, (z_vnot VR128:$y))), 8932b3482feSUlrich Weigand (VOC VR128:$x, VR128:$y)>; 8942b3482feSUlrich Weigand } 895ce4c1095SUlrich Weigand} 896ce4c1095SUlrich Weigand 897ce4c1095SUlrich Weiganddefm : BitwiseVectorOps<v16i8>; 898ce4c1095SUlrich Weiganddefm : BitwiseVectorOps<v8i16>; 899ce4c1095SUlrich Weiganddefm : BitwiseVectorOps<v4i32>; 900ce4c1095SUlrich Weiganddefm : BitwiseVectorOps<v2i64>; 901ce4c1095SUlrich Weigand 902ce4c1095SUlrich Weigand// Instantiate additional patterns for absolute-related expressions on 903ce4c1095SUlrich Weigand// type TYPE. LC is the negate instruction for TYPE and LP is the absolute 904ce4c1095SUlrich Weigand// instruction. 905ce4c1095SUlrich Weigandmulticlass IntegerAbsoluteVectorOps<ValueType type, Instruction lc, 906ce4c1095SUlrich Weigand Instruction lp, int shift> { 907ce4c1095SUlrich Weigand let Predicates = [FeatureVector] in { 908ce4c1095SUlrich Weigand def : Pat<(type (vselect (type (z_vicmph_zero VR128:$x)), 909ce4c1095SUlrich Weigand (z_vneg VR128:$x), VR128:$x)), 910ce4c1095SUlrich Weigand (lc (lp VR128:$x))>; 911ce4c1095SUlrich Weigand def : Pat<(type (vselect (type (z_vnot (z_vicmph_zero VR128:$x))), 912ce4c1095SUlrich Weigand VR128:$x, (z_vneg VR128:$x))), 913ce4c1095SUlrich Weigand (lc (lp VR128:$x))>; 914ce4c1095SUlrich Weigand def : Pat<(type (vselect (type (z_vicmpl_zero VR128:$x)), 915ce4c1095SUlrich Weigand VR128:$x, (z_vneg VR128:$x))), 916ce4c1095SUlrich Weigand (lc (lp VR128:$x))>; 917ce4c1095SUlrich Weigand def : Pat<(type (vselect (type (z_vnot (z_vicmpl_zero VR128:$x))), 918ce4c1095SUlrich Weigand (z_vneg VR128:$x), VR128:$x)), 919ce4c1095SUlrich Weigand (lc (lp VR128:$x))>; 920ce4c1095SUlrich Weigand def : Pat<(type (or (and (z_vsra_by_scalar VR128:$x, (i32 shift)), 921ce4c1095SUlrich Weigand (z_vneg VR128:$x)), 922ce4c1095SUlrich Weigand (and (z_vnot (z_vsra_by_scalar VR128:$x, (i32 shift))), 923ce4c1095SUlrich Weigand VR128:$x))), 924ce4c1095SUlrich Weigand (lp VR128:$x)>; 925ce4c1095SUlrich Weigand def : Pat<(type (or (and (z_vsra_by_scalar VR128:$x, (i32 shift)), 926ce4c1095SUlrich Weigand VR128:$x), 927ce4c1095SUlrich Weigand (and (z_vnot (z_vsra_by_scalar VR128:$x, (i32 shift))), 928ce4c1095SUlrich Weigand (z_vneg VR128:$x)))), 929ce4c1095SUlrich Weigand (lc (lp VR128:$x))>; 930ce4c1095SUlrich Weigand } 931ce4c1095SUlrich Weigand} 932ce4c1095SUlrich Weigand 933ce4c1095SUlrich Weiganddefm : IntegerAbsoluteVectorOps<v16i8, VLCB, VLPB, 7>; 934ce4c1095SUlrich Weiganddefm : IntegerAbsoluteVectorOps<v8i16, VLCH, VLPH, 15>; 935ce4c1095SUlrich Weiganddefm : IntegerAbsoluteVectorOps<v4i32, VLCF, VLPF, 31>; 936ce4c1095SUlrich Weiganddefm : IntegerAbsoluteVectorOps<v2i64, VLCG, VLPG, 63>; 937ce4c1095SUlrich Weigand 938ce4c1095SUlrich Weigand// Instantiate minimum- and maximum-related patterns for TYPE. CMPH is the 939ce4c1095SUlrich Weigand// signed or unsigned "set if greater than" comparison instruction and 940ce4c1095SUlrich Weigand// MIN and MAX are the associated minimum and maximum instructions. 941ce4c1095SUlrich Weigandmulticlass IntegerMinMaxVectorOps<ValueType type, SDPatternOperator cmph, 942ce4c1095SUlrich Weigand Instruction min, Instruction max> { 943ce4c1095SUlrich Weigand let Predicates = [FeatureVector] in { 944ce4c1095SUlrich Weigand def : Pat<(type (vselect (cmph VR128:$x, VR128:$y), VR128:$x, VR128:$y)), 945ce4c1095SUlrich Weigand (max VR128:$x, VR128:$y)>; 946ce4c1095SUlrich Weigand def : Pat<(type (vselect (cmph VR128:$x, VR128:$y), VR128:$y, VR128:$x)), 947ce4c1095SUlrich Weigand (min VR128:$x, VR128:$y)>; 948ce4c1095SUlrich Weigand def : Pat<(type (vselect (z_vnot (cmph VR128:$x, VR128:$y)), 949ce4c1095SUlrich Weigand VR128:$x, VR128:$y)), 950ce4c1095SUlrich Weigand (min VR128:$x, VR128:$y)>; 951ce4c1095SUlrich Weigand def : Pat<(type (vselect (z_vnot (cmph VR128:$x, VR128:$y)), 952ce4c1095SUlrich Weigand VR128:$y, VR128:$x)), 953ce4c1095SUlrich Weigand (max VR128:$x, VR128:$y)>; 954ce4c1095SUlrich Weigand } 955ce4c1095SUlrich Weigand} 956ce4c1095SUlrich Weigand 957ce4c1095SUlrich Weigand// Signed min/max. 958ce4c1095SUlrich Weiganddefm : IntegerMinMaxVectorOps<v16i8, z_vicmph, VMNB, VMXB>; 959ce4c1095SUlrich Weiganddefm : IntegerMinMaxVectorOps<v8i16, z_vicmph, VMNH, VMXH>; 960ce4c1095SUlrich Weiganddefm : IntegerMinMaxVectorOps<v4i32, z_vicmph, VMNF, VMXF>; 961ce4c1095SUlrich Weiganddefm : IntegerMinMaxVectorOps<v2i64, z_vicmph, VMNG, VMXG>; 962ce4c1095SUlrich Weigand 963ce4c1095SUlrich Weigand// Unsigned min/max. 964ce4c1095SUlrich Weiganddefm : IntegerMinMaxVectorOps<v16i8, z_vicmphl, VMNLB, VMXLB>; 965ce4c1095SUlrich Weiganddefm : IntegerMinMaxVectorOps<v8i16, z_vicmphl, VMNLH, VMXLH>; 966ce4c1095SUlrich Weiganddefm : IntegerMinMaxVectorOps<v4i32, z_vicmphl, VMNLF, VMXLF>; 967ce4c1095SUlrich Weiganddefm : IntegerMinMaxVectorOps<v2i64, z_vicmphl, VMNLG, VMXLG>; 968ce4c1095SUlrich Weigand 969a8b04e1cSUlrich Weigand//===----------------------------------------------------------------------===// 970a8b04e1cSUlrich Weigand// Integer comparison 971a8b04e1cSUlrich Weigand//===----------------------------------------------------------------------===// 972a8b04e1cSUlrich Weigand 973a8b04e1cSUlrich Weigandlet Predicates = [FeatureVector] in { 974a8b04e1cSUlrich Weigand // Element compare. 975a8b04e1cSUlrich Weigand let Defs = [CC] in { 9766e31ab38SUlrich Weigand def VEC : CompareVRRaGeneric<"vec", 0xE7DB>; 977a8b04e1cSUlrich Weigand def VECB : CompareVRRa<"vecb", 0xE7DB, null_frag, v128b, 0>; 978a8b04e1cSUlrich Weigand def VECH : CompareVRRa<"vech", 0xE7DB, null_frag, v128h, 1>; 979a8b04e1cSUlrich Weigand def VECF : CompareVRRa<"vecf", 0xE7DB, null_frag, v128f, 2>; 980a8b04e1cSUlrich Weigand def VECG : CompareVRRa<"vecg", 0xE7DB, null_frag, v128g, 3>; 981a8b04e1cSUlrich Weigand } 982a8b04e1cSUlrich Weigand 983a8b04e1cSUlrich Weigand // Element compare logical. 984a8b04e1cSUlrich Weigand let Defs = [CC] in { 9856e31ab38SUlrich Weigand def VECL : CompareVRRaGeneric<"vecl", 0xE7D9>; 986a8b04e1cSUlrich Weigand def VECLB : CompareVRRa<"veclb", 0xE7D9, null_frag, v128b, 0>; 987a8b04e1cSUlrich Weigand def VECLH : CompareVRRa<"veclh", 0xE7D9, null_frag, v128h, 1>; 988a8b04e1cSUlrich Weigand def VECLF : CompareVRRa<"veclf", 0xE7D9, null_frag, v128f, 2>; 989a8b04e1cSUlrich Weigand def VECLG : CompareVRRa<"veclg", 0xE7D9, null_frag, v128g, 3>; 990a8b04e1cSUlrich Weigand } 991a8b04e1cSUlrich Weigand 992a8b04e1cSUlrich Weigand // Compare equal. 9936e31ab38SUlrich Weigand def VCEQ : BinaryVRRbSPairGeneric<"vceq", 0xE7F8>; 994c1708b26SUlrich Weigand defm VCEQB : BinaryVRRbSPair<"vceqb", 0xE7F8, z_vicmpe, z_vicmpes, 995a8b04e1cSUlrich Weigand v128b, v128b, 0>; 996c1708b26SUlrich Weigand defm VCEQH : BinaryVRRbSPair<"vceqh", 0xE7F8, z_vicmpe, z_vicmpes, 997a8b04e1cSUlrich Weigand v128h, v128h, 1>; 998c1708b26SUlrich Weigand defm VCEQF : BinaryVRRbSPair<"vceqf", 0xE7F8, z_vicmpe, z_vicmpes, 999a8b04e1cSUlrich Weigand v128f, v128f, 2>; 1000c1708b26SUlrich Weigand defm VCEQG : BinaryVRRbSPair<"vceqg", 0xE7F8, z_vicmpe, z_vicmpes, 1001a8b04e1cSUlrich Weigand v128g, v128g, 3>; 1002a8b04e1cSUlrich Weigand 1003a8b04e1cSUlrich Weigand // Compare high. 10046e31ab38SUlrich Weigand def VCH : BinaryVRRbSPairGeneric<"vch", 0xE7FB>; 1005c1708b26SUlrich Weigand defm VCHB : BinaryVRRbSPair<"vchb", 0xE7FB, z_vicmph, z_vicmphs, 1006a8b04e1cSUlrich Weigand v128b, v128b, 0>; 1007c1708b26SUlrich Weigand defm VCHH : BinaryVRRbSPair<"vchh", 0xE7FB, z_vicmph, z_vicmphs, 1008a8b04e1cSUlrich Weigand v128h, v128h, 1>; 1009c1708b26SUlrich Weigand defm VCHF : BinaryVRRbSPair<"vchf", 0xE7FB, z_vicmph, z_vicmphs, 1010a8b04e1cSUlrich Weigand v128f, v128f, 2>; 1011c1708b26SUlrich Weigand defm VCHG : BinaryVRRbSPair<"vchg", 0xE7FB, z_vicmph, z_vicmphs, 1012a8b04e1cSUlrich Weigand v128g, v128g, 3>; 1013a8b04e1cSUlrich Weigand 1014a8b04e1cSUlrich Weigand // Compare high logical. 10156e31ab38SUlrich Weigand def VCHL : BinaryVRRbSPairGeneric<"vchl", 0xE7F9>; 1016c1708b26SUlrich Weigand defm VCHLB : BinaryVRRbSPair<"vchlb", 0xE7F9, z_vicmphl, z_vicmphls, 1017a8b04e1cSUlrich Weigand v128b, v128b, 0>; 1018c1708b26SUlrich Weigand defm VCHLH : BinaryVRRbSPair<"vchlh", 0xE7F9, z_vicmphl, z_vicmphls, 1019a8b04e1cSUlrich Weigand v128h, v128h, 1>; 1020c1708b26SUlrich Weigand defm VCHLF : BinaryVRRbSPair<"vchlf", 0xE7F9, z_vicmphl, z_vicmphls, 1021a8b04e1cSUlrich Weigand v128f, v128f, 2>; 1022c1708b26SUlrich Weigand defm VCHLG : BinaryVRRbSPair<"vchlg", 0xE7F9, z_vicmphl, z_vicmphls, 1023a8b04e1cSUlrich Weigand v128g, v128g, 3>; 1024a8b04e1cSUlrich Weigand 1025a8b04e1cSUlrich Weigand // Test under mask. 1026a8b04e1cSUlrich Weigand let Defs = [CC] in 1027c1708b26SUlrich Weigand def VTM : CompareVRRa<"vtm", 0xE7D8, z_vtm, v128b, 0>; 1028a8b04e1cSUlrich Weigand} 1029a8b04e1cSUlrich Weigand 1030a8b04e1cSUlrich Weigand//===----------------------------------------------------------------------===// 1031a8b04e1cSUlrich Weigand// Floating-point arithmetic 1032a8b04e1cSUlrich Weigand//===----------------------------------------------------------------------===// 1033a8b04e1cSUlrich Weigand 1034cd808237SUlrich Weigand// See comments in SystemZInstrFP.td for the suppression flags and 1035cd808237SUlrich Weigand// rounding modes. 1036cd808237SUlrich Weigandmulticlass VectorRounding<Instruction insn, TypedReg tr> { 10376c5d5ce5SUlrich Weigand def : FPConversion<insn, any_frint, tr, tr, 0, 0>; 10386c5d5ce5SUlrich Weigand def : FPConversion<insn, any_fnearbyint, tr, tr, 4, 0>; 10396c5d5ce5SUlrich Weigand def : FPConversion<insn, any_ffloor, tr, tr, 4, 7>; 10406c5d5ce5SUlrich Weigand def : FPConversion<insn, any_fceil, tr, tr, 4, 6>; 10416c5d5ce5SUlrich Weigand def : FPConversion<insn, any_ftrunc, tr, tr, 4, 5>; 10426c5d5ce5SUlrich Weigand def : FPConversion<insn, any_fround, tr, tr, 4, 1>; 1043cd808237SUlrich Weigand} 1044cd808237SUlrich Weigand 1045a8b04e1cSUlrich Weigandlet Predicates = [FeatureVector] in { 1046a8b04e1cSUlrich Weigand // Add. 1047665bebb4SJonas Paulsson let Uses = [FPC], mayRaiseFPException = 1, isCommutable = 1 in { 10486e31ab38SUlrich Weigand def VFA : BinaryVRRcFloatGeneric<"vfa", 0xE7E3>; 10496c5d5ce5SUlrich Weigand def VFADB : BinaryVRRc<"vfadb", 0xE7E3, any_fadd, v128db, v128db, 3, 0>; 105057feff93SJonas Paulsson def WFADB : BinaryVRRc<"wfadb", 0xE7E3, any_fadd, v64db, v64db, 3, 8, 0, 105157feff93SJonas Paulsson "adbr">; 105233435c4cSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in { 10536c5d5ce5SUlrich Weigand def VFASB : BinaryVRRc<"vfasb", 0xE7E3, any_fadd, v128sb, v128sb, 2, 0>; 105457feff93SJonas Paulsson def WFASB : BinaryVRRc<"wfasb", 0xE7E3, any_fadd, v32sb, v32sb, 2, 8, 0, 105557feff93SJonas Paulsson "aebr">; 10566c5d5ce5SUlrich Weigand def WFAXB : BinaryVRRc<"wfaxb", 0xE7E3, any_fadd, v128xb, v128xb, 4, 8>; 105733435c4cSUlrich Weigand } 10588e42f6ddSUlrich Weigand } 1059a8b04e1cSUlrich Weigand 10600f0a8b77SUlrich Weigand // Convert from fixed. 10616c5d5ce5SUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1 in { 10626e31ab38SUlrich Weigand def VCDG : TernaryVRRaFloatGeneric<"vcdg", 0xE7C3>; 1063a8b04e1cSUlrich Weigand def VCDGB : TernaryVRRa<"vcdgb", 0xE7C3, null_frag, v128db, v128g, 3, 0>; 1064a8b04e1cSUlrich Weigand def WCDGB : TernaryVRRa<"wcdgb", 0xE7C3, null_frag, v64db, v64g, 3, 8>; 10658e42f6ddSUlrich Weigand } 1066d1c0f14bSUlrich Weigand def : FPConversion<VCDGB, any_sint_to_fp, v128db, v128g, 0, 0>; 10670f0a8b77SUlrich Weigand let Predicates = [FeatureVectorEnhancements2] in { 10680f0a8b77SUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1 in { 10690f0a8b77SUlrich Weigand let isAsmParserOnly = 1 in 10700f0a8b77SUlrich Weigand def VCFPS : TernaryVRRaFloatGeneric<"vcfps", 0xE7C3>; 10710f0a8b77SUlrich Weigand def VCEFB : TernaryVRRa<"vcefb", 0xE7C3, null_frag, v128sb, v128g, 2, 0>; 10720f0a8b77SUlrich Weigand def WCEFB : TernaryVRRa<"wcefb", 0xE7C3, null_frag, v32sb, v32f, 2, 8>; 10730f0a8b77SUlrich Weigand } 1074d1c0f14bSUlrich Weigand def : FPConversion<VCEFB, any_sint_to_fp, v128sb, v128f, 0, 0>; 10750f0a8b77SUlrich Weigand } 1076a8b04e1cSUlrich Weigand 10770f0a8b77SUlrich Weigand // Convert from logical. 10786c5d5ce5SUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1 in { 10796e31ab38SUlrich Weigand def VCDLG : TernaryVRRaFloatGeneric<"vcdlg", 0xE7C1>; 1080a8b04e1cSUlrich Weigand def VCDLGB : TernaryVRRa<"vcdlgb", 0xE7C1, null_frag, v128db, v128g, 3, 0>; 1081a8b04e1cSUlrich Weigand def WCDLGB : TernaryVRRa<"wcdlgb", 0xE7C1, null_frag, v64db, v64g, 3, 8>; 10828e42f6ddSUlrich Weigand } 1083d1c0f14bSUlrich Weigand def : FPConversion<VCDLGB, any_uint_to_fp, v128db, v128g, 0, 0>; 10840f0a8b77SUlrich Weigand let Predicates = [FeatureVectorEnhancements2] in { 10850f0a8b77SUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1 in { 10860f0a8b77SUlrich Weigand let isAsmParserOnly = 1 in 10870f0a8b77SUlrich Weigand def VCFPL : TernaryVRRaFloatGeneric<"vcfpl", 0xE7C1>; 10880f0a8b77SUlrich Weigand def VCELFB : TernaryVRRa<"vcelfb", 0xE7C1, null_frag, v128sb, v128g, 2, 0>; 10890f0a8b77SUlrich Weigand def WCELFB : TernaryVRRa<"wcelfb", 0xE7C1, null_frag, v32sb, v32f, 2, 8>; 10900f0a8b77SUlrich Weigand } 1091d1c0f14bSUlrich Weigand def : FPConversion<VCELFB, any_uint_to_fp, v128sb, v128f, 0, 0>; 10920f0a8b77SUlrich Weigand } 1093a8b04e1cSUlrich Weigand 10940f0a8b77SUlrich Weigand // Convert to fixed. 10956c5d5ce5SUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1 in { 10966e31ab38SUlrich Weigand def VCGD : TernaryVRRaFloatGeneric<"vcgd", 0xE7C2>; 1097a8b04e1cSUlrich Weigand def VCGDB : TernaryVRRa<"vcgdb", 0xE7C2, null_frag, v128g, v128db, 3, 0>; 1098a8b04e1cSUlrich Weigand def WCGDB : TernaryVRRa<"wcgdb", 0xE7C2, null_frag, v64g, v64db, 3, 8>; 10998e42f6ddSUlrich Weigand } 1100cd808237SUlrich Weigand // Rounding mode should agree with SystemZInstrFP.td. 1101b21e2457SUlrich Weigand def : FPConversion<VCGDB, any_fp_to_sint, v128g, v128db, 0, 5>; 11020f0a8b77SUlrich Weigand let Predicates = [FeatureVectorEnhancements2] in { 11030f0a8b77SUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1 in { 11040f0a8b77SUlrich Weigand let isAsmParserOnly = 1 in 11050f0a8b77SUlrich Weigand def VCSFP : TernaryVRRaFloatGeneric<"vcsfp", 0xE7C2>; 11060f0a8b77SUlrich Weigand def VCFEB : TernaryVRRa<"vcfeb", 0xE7C2, null_frag, v128sb, v128g, 2, 0>; 11070f0a8b77SUlrich Weigand def WCFEB : TernaryVRRa<"wcfeb", 0xE7C2, null_frag, v32sb, v32f, 2, 8>; 11080f0a8b77SUlrich Weigand } 11090f0a8b77SUlrich Weigand // Rounding mode should agree with SystemZInstrFP.td. 1110b21e2457SUlrich Weigand def : FPConversion<VCFEB, any_fp_to_sint, v128f, v128sb, 0, 5>; 11110f0a8b77SUlrich Weigand } 1112a8b04e1cSUlrich Weigand 11130f0a8b77SUlrich Weigand // Convert to logical. 11146c5d5ce5SUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1 in { 11156e31ab38SUlrich Weigand def VCLGD : TernaryVRRaFloatGeneric<"vclgd", 0xE7C0>; 1116a8b04e1cSUlrich Weigand def VCLGDB : TernaryVRRa<"vclgdb", 0xE7C0, null_frag, v128g, v128db, 3, 0>; 1117a8b04e1cSUlrich Weigand def WCLGDB : TernaryVRRa<"wclgdb", 0xE7C0, null_frag, v64g, v64db, 3, 8>; 11188e42f6ddSUlrich Weigand } 1119cd808237SUlrich Weigand // Rounding mode should agree with SystemZInstrFP.td. 1120b21e2457SUlrich Weigand def : FPConversion<VCLGDB, any_fp_to_uint, v128g, v128db, 0, 5>; 11210f0a8b77SUlrich Weigand let Predicates = [FeatureVectorEnhancements2] in { 11220f0a8b77SUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1 in { 11230f0a8b77SUlrich Weigand let isAsmParserOnly = 1 in 11240f0a8b77SUlrich Weigand def VCLFP : TernaryVRRaFloatGeneric<"vclfp", 0xE7C0>; 11250f0a8b77SUlrich Weigand def VCLFEB : TernaryVRRa<"vclfeb", 0xE7C0, null_frag, v128sb, v128g, 2, 0>; 11260f0a8b77SUlrich Weigand def WCLFEB : TernaryVRRa<"wclfeb", 0xE7C0, null_frag, v32sb, v32f, 2, 8>; 11270f0a8b77SUlrich Weigand } 11280f0a8b77SUlrich Weigand // Rounding mode should agree with SystemZInstrFP.td. 1129b21e2457SUlrich Weigand def : FPConversion<VCLFEB, any_fp_to_uint, v128f, v128sb, 0, 5>; 11300f0a8b77SUlrich Weigand } 1131a8b04e1cSUlrich Weigand 1132a8b04e1cSUlrich Weigand // Divide. 11336c5d5ce5SUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1 in { 11346e31ab38SUlrich Weigand def VFD : BinaryVRRcFloatGeneric<"vfd", 0xE7E5>; 11356c5d5ce5SUlrich Weigand def VFDDB : BinaryVRRc<"vfddb", 0xE7E5, any_fdiv, v128db, v128db, 3, 0>; 113657feff93SJonas Paulsson def WFDDB : BinaryVRRc<"wfddb", 0xE7E5, any_fdiv, v64db, v64db, 3, 8, 0, 113757feff93SJonas Paulsson "ddbr">; 113833435c4cSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in { 11396c5d5ce5SUlrich Weigand def VFDSB : BinaryVRRc<"vfdsb", 0xE7E5, any_fdiv, v128sb, v128sb, 2, 0>; 114057feff93SJonas Paulsson def WFDSB : BinaryVRRc<"wfdsb", 0xE7E5, any_fdiv, v32sb, v32sb, 2, 8, 0, 114157feff93SJonas Paulsson "debr">; 11426c5d5ce5SUlrich Weigand def WFDXB : BinaryVRRc<"wfdxb", 0xE7E5, any_fdiv, v128xb, v128xb, 4, 8>; 114333435c4cSUlrich Weigand } 11448e42f6ddSUlrich Weigand } 1145a8b04e1cSUlrich Weigand 1146a8b04e1cSUlrich Weigand // Load FP integer. 11476c5d5ce5SUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1 in { 11486e31ab38SUlrich Weigand def VFI : TernaryVRRaFloatGeneric<"vfi", 0xE7C7>; 1149c1708b26SUlrich Weigand def VFIDB : TernaryVRRa<"vfidb", 0xE7C7, int_s390_vfidb, v128db, v128db, 3, 0>; 1150a8b04e1cSUlrich Weigand def WFIDB : TernaryVRRa<"wfidb", 0xE7C7, null_frag, v64db, v64db, 3, 8>; 11518e42f6ddSUlrich Weigand } 1152cd808237SUlrich Weigand defm : VectorRounding<VFIDB, v128db>; 115349506d78SUlrich Weigand defm : VectorRounding<WFIDB, v64db>; 115433435c4cSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in { 11556c5d5ce5SUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1 in { 115633435c4cSUlrich Weigand def VFISB : TernaryVRRa<"vfisb", 0xE7C7, int_s390_vfisb, v128sb, v128sb, 2, 0>; 115733435c4cSUlrich Weigand def WFISB : TernaryVRRa<"wfisb", 0xE7C7, null_frag, v32sb, v32sb, 2, 8>; 1158f2968d58SUlrich Weigand def WFIXB : TernaryVRRa<"wfixb", 0xE7C7, null_frag, v128xb, v128xb, 4, 8>; 11598e42f6ddSUlrich Weigand } 116033435c4cSUlrich Weigand defm : VectorRounding<VFISB, v128sb>; 116133435c4cSUlrich Weigand defm : VectorRounding<WFISB, v32sb>; 1162f2968d58SUlrich Weigand defm : VectorRounding<WFIXB, v128xb>; 116333435c4cSUlrich Weigand } 1164a8b04e1cSUlrich Weigand 1165a8b04e1cSUlrich Weigand // Load lengthened. 11666c5d5ce5SUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1 in { 11676e31ab38SUlrich Weigand def VLDE : UnaryVRRaFloatGeneric<"vlde", 0xE7C4>; 11689db13b5aSUlrich Weigand def VLDEB : UnaryVRRa<"vldeb", 0xE7C4, z_any_vextend, v128db, v128sb, 2, 0>; 116957feff93SJonas Paulsson def WLDEB : UnaryVRRa<"wldeb", 0xE7C4, any_fpextend, v64db, v32sb, 2, 8, 0, 117057feff93SJonas Paulsson "ldebr">; 11718e42f6ddSUlrich Weigand } 117233435c4cSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in { 11736c5d5ce5SUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1 in { 117433435c4cSUlrich Weigand let isAsmParserOnly = 1 in { 117533435c4cSUlrich Weigand def VFLL : UnaryVRRaFloatGeneric<"vfll", 0xE7C4>; 117633435c4cSUlrich Weigand def VFLLS : UnaryVRRa<"vflls", 0xE7C4, null_frag, v128db, v128sb, 2, 0>; 117733435c4cSUlrich Weigand def WFLLS : UnaryVRRa<"wflls", 0xE7C4, null_frag, v64db, v32sb, 2, 8>; 117833435c4cSUlrich Weigand } 11796c5d5ce5SUlrich Weigand def WFLLD : UnaryVRRa<"wflld", 0xE7C4, any_fpextend, v128xb, v64db, 3, 8>; 11808e42f6ddSUlrich Weigand } 11816c5d5ce5SUlrich Weigand def : Pat<(f128 (any_fpextend (f32 VR32:$src))), 1182f2968d58SUlrich Weigand (WFLLD (WLDEB VR32:$src))>; 118333435c4cSUlrich Weigand } 1184a8b04e1cSUlrich Weigand 118533435c4cSUlrich Weigand // Load rounded. 11866c5d5ce5SUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1 in { 11876e31ab38SUlrich Weigand def VLED : TernaryVRRaFloatGeneric<"vled", 0xE7C5>; 118833435c4cSUlrich Weigand def VLEDB : TernaryVRRa<"vledb", 0xE7C5, null_frag, v128sb, v128db, 3, 0>; 118933435c4cSUlrich Weigand def WLEDB : TernaryVRRa<"wledb", 0xE7C5, null_frag, v32sb, v64db, 3, 8>; 11908e42f6ddSUlrich Weigand } 1191ede8293dSUlrich Weigand def : Pat<(v4f32 (z_any_vround (v2f64 VR128:$src))), (VLEDB VR128:$src, 0, 0)>; 11926c5d5ce5SUlrich Weigand def : FPConversion<WLEDB, any_fpround, v32sb, v64db, 0, 0>; 119333435c4cSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in { 11946c5d5ce5SUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1 in { 119533435c4cSUlrich Weigand let isAsmParserOnly = 1 in { 119633435c4cSUlrich Weigand def VFLR : TernaryVRRaFloatGeneric<"vflr", 0xE7C5>; 119733435c4cSUlrich Weigand def VFLRD : TernaryVRRa<"vflrd", 0xE7C5, null_frag, v128sb, v128db, 3, 0>; 119833435c4cSUlrich Weigand def WFLRD : TernaryVRRa<"wflrd", 0xE7C5, null_frag, v32sb, v64db, 3, 8>; 119933435c4cSUlrich Weigand } 1200f2968d58SUlrich Weigand def WFLRX : TernaryVRRa<"wflrx", 0xE7C5, null_frag, v64db, v128xb, 4, 8>; 12018e42f6ddSUlrich Weigand } 12026c5d5ce5SUlrich Weigand def : FPConversion<WFLRX, any_fpround, v64db, v128xb, 0, 0>; 12036c5d5ce5SUlrich Weigand def : Pat<(f32 (any_fpround (f128 VR128:$src))), 1204f2968d58SUlrich Weigand (WLEDB (WFLRX VR128:$src, 0, 3), 0, 0)>; 120533435c4cSUlrich Weigand } 1206a8b04e1cSUlrich Weigand 12072b3482feSUlrich Weigand // Maximum. 12082b3482feSUlrich Weigand multiclass VectorMax<Instruction insn, TypedReg tr> { 12096c5d5ce5SUlrich Weigand def : FPMinMax<insn, any_fmaxnum, tr, 4>; 121019464613SUlrich Weigand def : FPMinMax<insn, any_fmaximum, tr, 1>; 12112b3482feSUlrich Weigand } 12122b3482feSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in { 12137e02da7dSJonas Paulsson let Uses = [FPC], mayRaiseFPException = 1, isCommutable = 1 in { 12142b3482feSUlrich Weigand def VFMAX : TernaryVRRcFloatGeneric<"vfmax", 0xE7EF>; 12152b3482feSUlrich Weigand def VFMAXDB : TernaryVRRcFloat<"vfmaxdb", 0xE7EF, int_s390_vfmaxdb, 12162b3482feSUlrich Weigand v128db, v128db, 3, 0>; 12172b3482feSUlrich Weigand def WFMAXDB : TernaryVRRcFloat<"wfmaxdb", 0xE7EF, null_frag, 12182b3482feSUlrich Weigand v64db, v64db, 3, 8>; 121933435c4cSUlrich Weigand def VFMAXSB : TernaryVRRcFloat<"vfmaxsb", 0xE7EF, int_s390_vfmaxsb, 122033435c4cSUlrich Weigand v128sb, v128sb, 2, 0>; 122133435c4cSUlrich Weigand def WFMAXSB : TernaryVRRcFloat<"wfmaxsb", 0xE7EF, null_frag, 122233435c4cSUlrich Weigand v32sb, v32sb, 2, 8>; 1223f2968d58SUlrich Weigand def WFMAXXB : TernaryVRRcFloat<"wfmaxxb", 0xE7EF, null_frag, 1224f2968d58SUlrich Weigand v128xb, v128xb, 4, 8>; 12258e42f6ddSUlrich Weigand } 12262b3482feSUlrich Weigand defm : VectorMax<VFMAXDB, v128db>; 12272b3482feSUlrich Weigand defm : VectorMax<WFMAXDB, v64db>; 122833435c4cSUlrich Weigand defm : VectorMax<VFMAXSB, v128sb>; 122933435c4cSUlrich Weigand defm : VectorMax<WFMAXSB, v32sb>; 1230f2968d58SUlrich Weigand defm : VectorMax<WFMAXXB, v128xb>; 12312b3482feSUlrich Weigand } 12322b3482feSUlrich Weigand 12332b3482feSUlrich Weigand // Minimum. 12342b3482feSUlrich Weigand multiclass VectorMin<Instruction insn, TypedReg tr> { 12356c5d5ce5SUlrich Weigand def : FPMinMax<insn, any_fminnum, tr, 4>; 123619464613SUlrich Weigand def : FPMinMax<insn, any_fminimum, tr, 1>; 12372b3482feSUlrich Weigand } 12382b3482feSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in { 12397e02da7dSJonas Paulsson let Uses = [FPC], mayRaiseFPException = 1, isCommutable = 1 in { 12402b3482feSUlrich Weigand def VFMIN : TernaryVRRcFloatGeneric<"vfmin", 0xE7EE>; 12412b3482feSUlrich Weigand def VFMINDB : TernaryVRRcFloat<"vfmindb", 0xE7EE, int_s390_vfmindb, 12422b3482feSUlrich Weigand v128db, v128db, 3, 0>; 12432b3482feSUlrich Weigand def WFMINDB : TernaryVRRcFloat<"wfmindb", 0xE7EE, null_frag, 12442b3482feSUlrich Weigand v64db, v64db, 3, 8>; 124533435c4cSUlrich Weigand def VFMINSB : TernaryVRRcFloat<"vfminsb", 0xE7EE, int_s390_vfminsb, 124633435c4cSUlrich Weigand v128sb, v128sb, 2, 0>; 124733435c4cSUlrich Weigand def WFMINSB : TernaryVRRcFloat<"wfminsb", 0xE7EE, null_frag, 124833435c4cSUlrich Weigand v32sb, v32sb, 2, 8>; 1249f2968d58SUlrich Weigand def WFMINXB : TernaryVRRcFloat<"wfminxb", 0xE7EE, null_frag, 1250f2968d58SUlrich Weigand v128xb, v128xb, 4, 8>; 12518e42f6ddSUlrich Weigand } 12522b3482feSUlrich Weigand defm : VectorMin<VFMINDB, v128db>; 12532b3482feSUlrich Weigand defm : VectorMin<WFMINDB, v64db>; 125433435c4cSUlrich Weigand defm : VectorMin<VFMINSB, v128sb>; 125533435c4cSUlrich Weigand defm : VectorMin<WFMINSB, v32sb>; 1256f2968d58SUlrich Weigand defm : VectorMin<WFMINXB, v128xb>; 12572b3482feSUlrich Weigand } 12582b3482feSUlrich Weigand 1259a8b04e1cSUlrich Weigand // Multiply. 1260665bebb4SJonas Paulsson let Uses = [FPC], mayRaiseFPException = 1, isCommutable = 1 in { 12616e31ab38SUlrich Weigand def VFM : BinaryVRRcFloatGeneric<"vfm", 0xE7E7>; 12626c5d5ce5SUlrich Weigand def VFMDB : BinaryVRRc<"vfmdb", 0xE7E7, any_fmul, v128db, v128db, 3, 0>; 126357feff93SJonas Paulsson def WFMDB : BinaryVRRc<"wfmdb", 0xE7E7, any_fmul, v64db, v64db, 3, 8, 0, 126457feff93SJonas Paulsson "mdbr">; 126533435c4cSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in { 12666c5d5ce5SUlrich Weigand def VFMSB : BinaryVRRc<"vfmsb", 0xE7E7, any_fmul, v128sb, v128sb, 2, 0>; 126757feff93SJonas Paulsson def WFMSB : BinaryVRRc<"wfmsb", 0xE7E7, any_fmul, v32sb, v32sb, 2, 8, 0, 126857feff93SJonas Paulsson "meebr">; 12696c5d5ce5SUlrich Weigand def WFMXB : BinaryVRRc<"wfmxb", 0xE7E7, any_fmul, v128xb, v128xb, 4, 8>; 127033435c4cSUlrich Weigand } 12718e42f6ddSUlrich Weigand } 1272a8b04e1cSUlrich Weigand 1273a8b04e1cSUlrich Weigand // Multiply and add. 12747e02da7dSJonas Paulsson let Uses = [FPC], mayRaiseFPException = 1, isCommutable = 1 in { 12756e31ab38SUlrich Weigand def VFMA : TernaryVRReFloatGeneric<"vfma", 0xE78F>; 12766c5d5ce5SUlrich Weigand def VFMADB : TernaryVRRe<"vfmadb", 0xE78F, any_fma, v128db, v128db, 0, 3>; 127757feff93SJonas Paulsson def WFMADB : TernaryVRRe<"wfmadb", 0xE78F, any_fma, v64db, v64db, 8, 3, 127857feff93SJonas Paulsson "madbr">; 127933435c4cSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in { 12806c5d5ce5SUlrich Weigand def VFMASB : TernaryVRRe<"vfmasb", 0xE78F, any_fma, v128sb, v128sb, 0, 2>; 128157feff93SJonas Paulsson def WFMASB : TernaryVRRe<"wfmasb", 0xE78F, any_fma, v32sb, v32sb, 8, 2, 128257feff93SJonas Paulsson "maebr">; 12836c5d5ce5SUlrich Weigand def WFMAXB : TernaryVRRe<"wfmaxb", 0xE78F, any_fma, v128xb, v128xb, 8, 4>; 128433435c4cSUlrich Weigand } 12858e42f6ddSUlrich Weigand } 1286a8b04e1cSUlrich Weigand 1287a8b04e1cSUlrich Weigand // Multiply and subtract. 12887e02da7dSJonas Paulsson let Uses = [FPC], mayRaiseFPException = 1, isCommutable = 1 in { 12896e31ab38SUlrich Weigand def VFMS : TernaryVRReFloatGeneric<"vfms", 0xE78E>; 12906c5d5ce5SUlrich Weigand def VFMSDB : TernaryVRRe<"vfmsdb", 0xE78E, any_fms, v128db, v128db, 0, 3>; 129157feff93SJonas Paulsson def WFMSDB : TernaryVRRe<"wfmsdb", 0xE78E, any_fms, v64db, v64db, 8, 3, 129257feff93SJonas Paulsson "msdbr">; 129333435c4cSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in { 12946c5d5ce5SUlrich Weigand def VFMSSB : TernaryVRRe<"vfmssb", 0xE78E, any_fms, v128sb, v128sb, 0, 2>; 129557feff93SJonas Paulsson def WFMSSB : TernaryVRRe<"wfmssb", 0xE78E, any_fms, v32sb, v32sb, 8, 2, 129657feff93SJonas Paulsson "msebr">; 12976c5d5ce5SUlrich Weigand def WFMSXB : TernaryVRRe<"wfmsxb", 0xE78E, any_fms, v128xb, v128xb, 8, 4>; 129833435c4cSUlrich Weigand } 12998e42f6ddSUlrich Weigand } 1300a8b04e1cSUlrich Weigand 13012b3482feSUlrich Weigand // Negative multiply and add. 13027e02da7dSJonas Paulsson let Uses = [FPC], mayRaiseFPException = 1, isCommutable = 1, 13036c5d5ce5SUlrich Weigand Predicates = [FeatureVectorEnhancements1] in { 13042b3482feSUlrich Weigand def VFNMA : TernaryVRReFloatGeneric<"vfnma", 0xE79F>; 13056c5d5ce5SUlrich Weigand def VFNMADB : TernaryVRRe<"vfnmadb", 0xE79F, any_fnma, v128db, v128db, 0, 3>; 13066c5d5ce5SUlrich Weigand def WFNMADB : TernaryVRRe<"wfnmadb", 0xE79F, any_fnma, v64db, v64db, 8, 3>; 13076c5d5ce5SUlrich Weigand def VFNMASB : TernaryVRRe<"vfnmasb", 0xE79F, any_fnma, v128sb, v128sb, 0, 2>; 13086c5d5ce5SUlrich Weigand def WFNMASB : TernaryVRRe<"wfnmasb", 0xE79F, any_fnma, v32sb, v32sb, 8, 2>; 13096c5d5ce5SUlrich Weigand def WFNMAXB : TernaryVRRe<"wfnmaxb", 0xE79F, any_fnma, v128xb, v128xb, 8, 4>; 13102b3482feSUlrich Weigand } 13112b3482feSUlrich Weigand 13122b3482feSUlrich Weigand // Negative multiply and subtract. 13137e02da7dSJonas Paulsson let Uses = [FPC], mayRaiseFPException = 1, isCommutable = 1, 13146c5d5ce5SUlrich Weigand Predicates = [FeatureVectorEnhancements1] in { 13152b3482feSUlrich Weigand def VFNMS : TernaryVRReFloatGeneric<"vfnms", 0xE79E>; 13166c5d5ce5SUlrich Weigand def VFNMSDB : TernaryVRRe<"vfnmsdb", 0xE79E, any_fnms, v128db, v128db, 0, 3>; 13176c5d5ce5SUlrich Weigand def WFNMSDB : TernaryVRRe<"wfnmsdb", 0xE79E, any_fnms, v64db, v64db, 8, 3>; 13186c5d5ce5SUlrich Weigand def VFNMSSB : TernaryVRRe<"vfnmssb", 0xE79E, any_fnms, v128sb, v128sb, 0, 2>; 13196c5d5ce5SUlrich Weigand def WFNMSSB : TernaryVRRe<"wfnmssb", 0xE79E, any_fnms, v32sb, v32sb, 8, 2>; 13206c5d5ce5SUlrich Weigand def WFNMSXB : TernaryVRRe<"wfnmsxb", 0xE79E, any_fnms, v128xb, v128xb, 8, 4>; 13212b3482feSUlrich Weigand } 13222b3482feSUlrich Weigand 13236e31ab38SUlrich Weigand // Perform sign operation. 13246e31ab38SUlrich Weigand def VFPSO : BinaryVRRaFloatGeneric<"vfpso", 0xE7CC>; 13256e31ab38SUlrich Weigand def VFPSODB : BinaryVRRa<"vfpsodb", 0xE7CC, null_frag, v128db, v128db, 3, 0>; 13266e31ab38SUlrich Weigand def WFPSODB : BinaryVRRa<"wfpsodb", 0xE7CC, null_frag, v64db, v64db, 3, 8>; 132733435c4cSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in { 132833435c4cSUlrich Weigand def VFPSOSB : BinaryVRRa<"vfpsosb", 0xE7CC, null_frag, v128sb, v128sb, 2, 0>; 132933435c4cSUlrich Weigand def WFPSOSB : BinaryVRRa<"wfpsosb", 0xE7CC, null_frag, v32sb, v32sb, 2, 8>; 1330f2968d58SUlrich Weigand def WFPSOXB : BinaryVRRa<"wfpsoxb", 0xE7CC, null_frag, v128xb, v128xb, 4, 8>; 133133435c4cSUlrich Weigand } 13326e31ab38SUlrich Weigand 13336e31ab38SUlrich Weigand // Load complement. 1334cd808237SUlrich Weigand def VFLCDB : UnaryVRRa<"vflcdb", 0xE7CC, fneg, v128db, v128db, 3, 0, 0>; 133549506d78SUlrich Weigand def WFLCDB : UnaryVRRa<"wflcdb", 0xE7CC, fneg, v64db, v64db, 3, 8, 0>; 133633435c4cSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in { 133733435c4cSUlrich Weigand def VFLCSB : UnaryVRRa<"vflcsb", 0xE7CC, fneg, v128sb, v128sb, 2, 0, 0>; 133833435c4cSUlrich Weigand def WFLCSB : UnaryVRRa<"wflcsb", 0xE7CC, fneg, v32sb, v32sb, 2, 8, 0>; 1339f2968d58SUlrich Weigand def WFLCXB : UnaryVRRa<"wflcxb", 0xE7CC, fneg, v128xb, v128xb, 4, 8, 0>; 134033435c4cSUlrich Weigand } 1341a8b04e1cSUlrich Weigand 1342a8b04e1cSUlrich Weigand // Load negative. 1343cd808237SUlrich Weigand def VFLNDB : UnaryVRRa<"vflndb", 0xE7CC, fnabs, v128db, v128db, 3, 0, 1>; 134449506d78SUlrich Weigand def WFLNDB : UnaryVRRa<"wflndb", 0xE7CC, fnabs, v64db, v64db, 3, 8, 1>; 134533435c4cSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in { 134633435c4cSUlrich Weigand def VFLNSB : UnaryVRRa<"vflnsb", 0xE7CC, fnabs, v128sb, v128sb, 2, 0, 1>; 134733435c4cSUlrich Weigand def WFLNSB : UnaryVRRa<"wflnsb", 0xE7CC, fnabs, v32sb, v32sb, 2, 8, 1>; 1348f2968d58SUlrich Weigand def WFLNXB : UnaryVRRa<"wflnxb", 0xE7CC, fnabs, v128xb, v128xb, 4, 8, 1>; 134933435c4cSUlrich Weigand } 1350a8b04e1cSUlrich Weigand 1351a8b04e1cSUlrich Weigand // Load positive. 1352cd808237SUlrich Weigand def VFLPDB : UnaryVRRa<"vflpdb", 0xE7CC, fabs, v128db, v128db, 3, 0, 2>; 135349506d78SUlrich Weigand def WFLPDB : UnaryVRRa<"wflpdb", 0xE7CC, fabs, v64db, v64db, 3, 8, 2>; 135433435c4cSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in { 135533435c4cSUlrich Weigand def VFLPSB : UnaryVRRa<"vflpsb", 0xE7CC, fabs, v128sb, v128sb, 2, 0, 2>; 135633435c4cSUlrich Weigand def WFLPSB : UnaryVRRa<"wflpsb", 0xE7CC, fabs, v32sb, v32sb, 2, 8, 2>; 1357f2968d58SUlrich Weigand def WFLPXB : UnaryVRRa<"wflpxb", 0xE7CC, fabs, v128xb, v128xb, 4, 8, 2>; 135833435c4cSUlrich Weigand } 1359a8b04e1cSUlrich Weigand 1360a8b04e1cSUlrich Weigand // Square root. 13616c5d5ce5SUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1 in { 13626e31ab38SUlrich Weigand def VFSQ : UnaryVRRaFloatGeneric<"vfsq", 0xE7CE>; 13636c5d5ce5SUlrich Weigand def VFSQDB : UnaryVRRa<"vfsqdb", 0xE7CE, any_fsqrt, v128db, v128db, 3, 0>; 136457feff93SJonas Paulsson def WFSQDB : UnaryVRRa<"wfsqdb", 0xE7CE, any_fsqrt, v64db, v64db, 3, 8, 0, 136557feff93SJonas Paulsson "sqdbr">; 136633435c4cSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in { 13676c5d5ce5SUlrich Weigand def VFSQSB : UnaryVRRa<"vfsqsb", 0xE7CE, any_fsqrt, v128sb, v128sb, 2, 0>; 136857feff93SJonas Paulsson def WFSQSB : UnaryVRRa<"wfsqsb", 0xE7CE, any_fsqrt, v32sb, v32sb, 2, 8, 0, 136957feff93SJonas Paulsson "sqebr">; 13706c5d5ce5SUlrich Weigand def WFSQXB : UnaryVRRa<"wfsqxb", 0xE7CE, any_fsqrt, v128xb, v128xb, 4, 8>; 137133435c4cSUlrich Weigand } 13728e42f6ddSUlrich Weigand } 1373a8b04e1cSUlrich Weigand 1374a8b04e1cSUlrich Weigand // Subtract. 13756c5d5ce5SUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1 in { 13766e31ab38SUlrich Weigand def VFS : BinaryVRRcFloatGeneric<"vfs", 0xE7E2>; 13776c5d5ce5SUlrich Weigand def VFSDB : BinaryVRRc<"vfsdb", 0xE7E2, any_fsub, v128db, v128db, 3, 0>; 137857feff93SJonas Paulsson def WFSDB : BinaryVRRc<"wfsdb", 0xE7E2, any_fsub, v64db, v64db, 3, 8, 0, 137957feff93SJonas Paulsson "sdbr">; 138033435c4cSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in { 13816c5d5ce5SUlrich Weigand def VFSSB : BinaryVRRc<"vfssb", 0xE7E2, any_fsub, v128sb, v128sb, 2, 0>; 138257feff93SJonas Paulsson def WFSSB : BinaryVRRc<"wfssb", 0xE7E2, any_fsub, v32sb, v32sb, 2, 8, 0, 138357feff93SJonas Paulsson "sebr">; 13846c5d5ce5SUlrich Weigand def WFSXB : BinaryVRRc<"wfsxb", 0xE7E2, any_fsub, v128xb, v128xb, 4, 8>; 138533435c4cSUlrich Weigand } 13868e42f6ddSUlrich Weigand } 1387a8b04e1cSUlrich Weigand 1388a8b04e1cSUlrich Weigand // Test data class immediate. 1389a8b04e1cSUlrich Weigand let Defs = [CC] in { 13906e31ab38SUlrich Weigand def VFTCI : BinaryVRIeFloatGeneric<"vftci", 0xE74A>; 1391c1708b26SUlrich Weigand def VFTCIDB : BinaryVRIe<"vftcidb", 0xE74A, z_vftci, v128g, v128db, 3, 0>; 1392a8b04e1cSUlrich Weigand def WFTCIDB : BinaryVRIe<"wftcidb", 0xE74A, null_frag, v64g, v64db, 3, 8>; 139333435c4cSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in { 139433435c4cSUlrich Weigand def VFTCISB : BinaryVRIe<"vftcisb", 0xE74A, z_vftci, v128f, v128sb, 2, 0>; 139533435c4cSUlrich Weigand def WFTCISB : BinaryVRIe<"wftcisb", 0xE74A, null_frag, v32f, v32sb, 2, 8>; 1396f2968d58SUlrich Weigand def WFTCIXB : BinaryVRIe<"wftcixb", 0xE74A, null_frag, v128q, v128xb, 4, 8>; 139733435c4cSUlrich Weigand } 1398a8b04e1cSUlrich Weigand } 1399a8b04e1cSUlrich Weigand} 1400a8b04e1cSUlrich Weigand 1401a8b04e1cSUlrich Weigand//===----------------------------------------------------------------------===// 1402a8b04e1cSUlrich Weigand// Floating-point comparison 1403a8b04e1cSUlrich Weigand//===----------------------------------------------------------------------===// 1404a8b04e1cSUlrich Weigand 1405a8b04e1cSUlrich Weigandlet Predicates = [FeatureVector] in { 1406a8b04e1cSUlrich Weigand // Compare scalar. 14076c5d5ce5SUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1, Defs = [CC] in { 14086e31ab38SUlrich Weigand def WFC : CompareVRRaFloatGeneric<"wfc", 0xE7CB>; 140957feff93SJonas Paulsson def WFCDB : CompareVRRa<"wfcdb", 0xE7CB, z_any_fcmp, v64db, 3, "cdbr">; 141033435c4cSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in { 141157feff93SJonas Paulsson def WFCSB : CompareVRRa<"wfcsb", 0xE7CB, z_any_fcmp, v32sb, 2, "cebr">; 14129db13b5aSUlrich Weigand def WFCXB : CompareVRRa<"wfcxb", 0xE7CB, z_any_fcmp, v128xb, 4>; 141333435c4cSUlrich Weigand } 14146e31ab38SUlrich Weigand } 1415a8b04e1cSUlrich Weigand 1416a8b04e1cSUlrich Weigand // Compare and signal scalar. 14176c5d5ce5SUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1, Defs = [CC] in { 14186e31ab38SUlrich Weigand def WFK : CompareVRRaFloatGeneric<"wfk", 0xE7CA>; 141957feff93SJonas Paulsson def WFKDB : CompareVRRa<"wfkdb", 0xE7CA, z_strict_fcmps, v64db, 3, "kdbr">; 142033435c4cSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in { 142157feff93SJonas Paulsson def WFKSB : CompareVRRa<"wfksb", 0xE7CA, z_strict_fcmps, v32sb, 2, "kebr">; 14229db13b5aSUlrich Weigand def WFKXB : CompareVRRa<"wfkxb", 0xE7CA, z_strict_fcmps, v128xb, 4>; 142333435c4cSUlrich Weigand } 14246e31ab38SUlrich Weigand } 1425a8b04e1cSUlrich Weigand 1426a8b04e1cSUlrich Weigand // Compare equal. 14276c5d5ce5SUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1 in { 14286e31ab38SUlrich Weigand def VFCE : BinaryVRRcSPairFloatGeneric<"vfce", 0xE7E8>; 14299db13b5aSUlrich Weigand defm VFCEDB : BinaryVRRcSPair<"vfcedb", 0xE7E8, z_any_vfcmpe, z_vfcmpes, 1430a8b04e1cSUlrich Weigand v128g, v128db, 3, 0>; 1431a8b04e1cSUlrich Weigand defm WFCEDB : BinaryVRRcSPair<"wfcedb", 0xE7E8, null_frag, null_frag, 1432a8b04e1cSUlrich Weigand v64g, v64db, 3, 8>; 143333435c4cSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in { 14349db13b5aSUlrich Weigand defm VFCESB : BinaryVRRcSPair<"vfcesb", 0xE7E8, z_any_vfcmpe, z_vfcmpes, 143533435c4cSUlrich Weigand v128f, v128sb, 2, 0>; 143633435c4cSUlrich Weigand defm WFCESB : BinaryVRRcSPair<"wfcesb", 0xE7E8, null_frag, null_frag, 143733435c4cSUlrich Weigand v32f, v32sb, 2, 8>; 1438f2968d58SUlrich Weigand defm WFCEXB : BinaryVRRcSPair<"wfcexb", 0xE7E8, null_frag, null_frag, 1439f2968d58SUlrich Weigand v128q, v128xb, 4, 8>; 144033435c4cSUlrich Weigand } 14418e42f6ddSUlrich Weigand } 1442a8b04e1cSUlrich Weigand 14432b3482feSUlrich Weigand // Compare and signal equal. 14446c5d5ce5SUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1, 14456c5d5ce5SUlrich Weigand Predicates = [FeatureVectorEnhancements1] in { 14469db13b5aSUlrich Weigand defm VFKEDB : BinaryVRRcSPair<"vfkedb", 0xE7E8, z_strict_vfcmpes, null_frag, 14472b3482feSUlrich Weigand v128g, v128db, 3, 4>; 14482b3482feSUlrich Weigand defm WFKEDB : BinaryVRRcSPair<"wfkedb", 0xE7E8, null_frag, null_frag, 14492b3482feSUlrich Weigand v64g, v64db, 3, 12>; 14509db13b5aSUlrich Weigand defm VFKESB : BinaryVRRcSPair<"vfkesb", 0xE7E8, z_strict_vfcmpes, null_frag, 145133435c4cSUlrich Weigand v128f, v128sb, 2, 4>; 145233435c4cSUlrich Weigand defm WFKESB : BinaryVRRcSPair<"wfkesb", 0xE7E8, null_frag, null_frag, 145333435c4cSUlrich Weigand v32f, v32sb, 2, 12>; 1454f2968d58SUlrich Weigand defm WFKEXB : BinaryVRRcSPair<"wfkexb", 0xE7E8, null_frag, null_frag, 1455f2968d58SUlrich Weigand v128q, v128xb, 4, 12>; 14562b3482feSUlrich Weigand } 14572b3482feSUlrich Weigand 1458a8b04e1cSUlrich Weigand // Compare high. 14596c5d5ce5SUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1 in { 14606e31ab38SUlrich Weigand def VFCH : BinaryVRRcSPairFloatGeneric<"vfch", 0xE7EB>; 14619db13b5aSUlrich Weigand defm VFCHDB : BinaryVRRcSPair<"vfchdb", 0xE7EB, z_any_vfcmph, z_vfcmphs, 1462a8b04e1cSUlrich Weigand v128g, v128db, 3, 0>; 1463a8b04e1cSUlrich Weigand defm WFCHDB : BinaryVRRcSPair<"wfchdb", 0xE7EB, null_frag, null_frag, 1464a8b04e1cSUlrich Weigand v64g, v64db, 3, 8>; 146533435c4cSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in { 14669db13b5aSUlrich Weigand defm VFCHSB : BinaryVRRcSPair<"vfchsb", 0xE7EB, z_any_vfcmph, z_vfcmphs, 146733435c4cSUlrich Weigand v128f, v128sb, 2, 0>; 146833435c4cSUlrich Weigand defm WFCHSB : BinaryVRRcSPair<"wfchsb", 0xE7EB, null_frag, null_frag, 146933435c4cSUlrich Weigand v32f, v32sb, 2, 8>; 1470f2968d58SUlrich Weigand defm WFCHXB : BinaryVRRcSPair<"wfchxb", 0xE7EB, null_frag, null_frag, 1471f2968d58SUlrich Weigand v128q, v128xb, 4, 8>; 147233435c4cSUlrich Weigand } 14738e42f6ddSUlrich Weigand } 1474a8b04e1cSUlrich Weigand 14752b3482feSUlrich Weigand // Compare and signal high. 14766c5d5ce5SUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1, 14776c5d5ce5SUlrich Weigand Predicates = [FeatureVectorEnhancements1] in { 14789db13b5aSUlrich Weigand defm VFKHDB : BinaryVRRcSPair<"vfkhdb", 0xE7EB, z_strict_vfcmphs, null_frag, 14792b3482feSUlrich Weigand v128g, v128db, 3, 4>; 14802b3482feSUlrich Weigand defm WFKHDB : BinaryVRRcSPair<"wfkhdb", 0xE7EB, null_frag, null_frag, 14812b3482feSUlrich Weigand v64g, v64db, 3, 12>; 14829db13b5aSUlrich Weigand defm VFKHSB : BinaryVRRcSPair<"vfkhsb", 0xE7EB, z_strict_vfcmphs, null_frag, 148333435c4cSUlrich Weigand v128f, v128sb, 2, 4>; 148433435c4cSUlrich Weigand defm WFKHSB : BinaryVRRcSPair<"wfkhsb", 0xE7EB, null_frag, null_frag, 148533435c4cSUlrich Weigand v32f, v32sb, 2, 12>; 1486f2968d58SUlrich Weigand defm WFKHXB : BinaryVRRcSPair<"wfkhxb", 0xE7EB, null_frag, null_frag, 1487f2968d58SUlrich Weigand v128q, v128xb, 4, 12>; 14882b3482feSUlrich Weigand } 14892b3482feSUlrich Weigand 1490a8b04e1cSUlrich Weigand // Compare high or equal. 14916c5d5ce5SUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1 in { 14926e31ab38SUlrich Weigand def VFCHE : BinaryVRRcSPairFloatGeneric<"vfche", 0xE7EA>; 14939db13b5aSUlrich Weigand defm VFCHEDB : BinaryVRRcSPair<"vfchedb", 0xE7EA, z_any_vfcmphe, z_vfcmphes, 1494a8b04e1cSUlrich Weigand v128g, v128db, 3, 0>; 1495a8b04e1cSUlrich Weigand defm WFCHEDB : BinaryVRRcSPair<"wfchedb", 0xE7EA, null_frag, null_frag, 1496a8b04e1cSUlrich Weigand v64g, v64db, 3, 8>; 149733435c4cSUlrich Weigand let Predicates = [FeatureVectorEnhancements1] in { 14989db13b5aSUlrich Weigand defm VFCHESB : BinaryVRRcSPair<"vfchesb", 0xE7EA, z_any_vfcmphe, z_vfcmphes, 149933435c4cSUlrich Weigand v128f, v128sb, 2, 0>; 150033435c4cSUlrich Weigand defm WFCHESB : BinaryVRRcSPair<"wfchesb", 0xE7EA, null_frag, null_frag, 150133435c4cSUlrich Weigand v32f, v32sb, 2, 8>; 1502f2968d58SUlrich Weigand defm WFCHEXB : BinaryVRRcSPair<"wfchexb", 0xE7EA, null_frag, null_frag, 1503f2968d58SUlrich Weigand v128q, v128xb, 4, 8>; 150433435c4cSUlrich Weigand } 15058e42f6ddSUlrich Weigand } 15062b3482feSUlrich Weigand 15072b3482feSUlrich Weigand // Compare and signal high or equal. 15086c5d5ce5SUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1, 15096c5d5ce5SUlrich Weigand Predicates = [FeatureVectorEnhancements1] in { 15109db13b5aSUlrich Weigand defm VFKHEDB : BinaryVRRcSPair<"vfkhedb", 0xE7EA, z_strict_vfcmphes, null_frag, 15112b3482feSUlrich Weigand v128g, v128db, 3, 4>; 15122b3482feSUlrich Weigand defm WFKHEDB : BinaryVRRcSPair<"wfkhedb", 0xE7EA, null_frag, null_frag, 15132b3482feSUlrich Weigand v64g, v64db, 3, 12>; 15149db13b5aSUlrich Weigand defm VFKHESB : BinaryVRRcSPair<"vfkhesb", 0xE7EA, z_strict_vfcmphes, null_frag, 151533435c4cSUlrich Weigand v128f, v128sb, 2, 4>; 151633435c4cSUlrich Weigand defm WFKHESB : BinaryVRRcSPair<"wfkhesb", 0xE7EA, null_frag, null_frag, 151733435c4cSUlrich Weigand v32f, v32sb, 2, 12>; 1518f2968d58SUlrich Weigand defm WFKHEXB : BinaryVRRcSPair<"wfkhexb", 0xE7EA, null_frag, null_frag, 1519f2968d58SUlrich Weigand v128q, v128xb, 4, 12>; 15202b3482feSUlrich Weigand } 1521a8b04e1cSUlrich Weigand} 1522a8b04e1cSUlrich Weigand 1523a8b04e1cSUlrich Weigand//===----------------------------------------------------------------------===// 1524ce4c1095SUlrich Weigand// Conversions 1525ce4c1095SUlrich Weigand//===----------------------------------------------------------------------===// 1526ce4c1095SUlrich Weigand 1527ce4c1095SUlrich Weiganddef : Pat<(v16i8 (bitconvert (v8i16 VR128:$src))), (v16i8 VR128:$src)>; 1528ce4c1095SUlrich Weiganddef : Pat<(v16i8 (bitconvert (v4i32 VR128:$src))), (v16i8 VR128:$src)>; 1529ce4c1095SUlrich Weiganddef : Pat<(v16i8 (bitconvert (v2i64 VR128:$src))), (v16i8 VR128:$src)>; 153080b3af7aSUlrich Weiganddef : Pat<(v16i8 (bitconvert (v4f32 VR128:$src))), (v16i8 VR128:$src)>; 1531cd808237SUlrich Weiganddef : Pat<(v16i8 (bitconvert (v2f64 VR128:$src))), (v16i8 VR128:$src)>; 1532f2968d58SUlrich Weiganddef : Pat<(v16i8 (bitconvert (f128 VR128:$src))), (v16i8 VR128:$src)>; 1533ce4c1095SUlrich Weigand 1534ce4c1095SUlrich Weiganddef : Pat<(v8i16 (bitconvert (v16i8 VR128:$src))), (v8i16 VR128:$src)>; 1535ce4c1095SUlrich Weiganddef : Pat<(v8i16 (bitconvert (v4i32 VR128:$src))), (v8i16 VR128:$src)>; 1536ce4c1095SUlrich Weiganddef : Pat<(v8i16 (bitconvert (v2i64 VR128:$src))), (v8i16 VR128:$src)>; 153780b3af7aSUlrich Weiganddef : Pat<(v8i16 (bitconvert (v4f32 VR128:$src))), (v8i16 VR128:$src)>; 1538cd808237SUlrich Weiganddef : Pat<(v8i16 (bitconvert (v2f64 VR128:$src))), (v8i16 VR128:$src)>; 1539f2968d58SUlrich Weiganddef : Pat<(v8i16 (bitconvert (f128 VR128:$src))), (v8i16 VR128:$src)>; 1540ce4c1095SUlrich Weigand 1541ce4c1095SUlrich Weiganddef : Pat<(v4i32 (bitconvert (v16i8 VR128:$src))), (v4i32 VR128:$src)>; 1542ce4c1095SUlrich Weiganddef : Pat<(v4i32 (bitconvert (v8i16 VR128:$src))), (v4i32 VR128:$src)>; 1543ce4c1095SUlrich Weiganddef : Pat<(v4i32 (bitconvert (v2i64 VR128:$src))), (v4i32 VR128:$src)>; 154480b3af7aSUlrich Weiganddef : Pat<(v4i32 (bitconvert (v4f32 VR128:$src))), (v4i32 VR128:$src)>; 1545cd808237SUlrich Weiganddef : Pat<(v4i32 (bitconvert (v2f64 VR128:$src))), (v4i32 VR128:$src)>; 1546f2968d58SUlrich Weiganddef : Pat<(v4i32 (bitconvert (f128 VR128:$src))), (v4i32 VR128:$src)>; 1547ce4c1095SUlrich Weigand 1548ce4c1095SUlrich Weiganddef : Pat<(v2i64 (bitconvert (v16i8 VR128:$src))), (v2i64 VR128:$src)>; 1549ce4c1095SUlrich Weiganddef : Pat<(v2i64 (bitconvert (v8i16 VR128:$src))), (v2i64 VR128:$src)>; 1550ce4c1095SUlrich Weiganddef : Pat<(v2i64 (bitconvert (v4i32 VR128:$src))), (v2i64 VR128:$src)>; 155180b3af7aSUlrich Weiganddef : Pat<(v2i64 (bitconvert (v4f32 VR128:$src))), (v2i64 VR128:$src)>; 1552cd808237SUlrich Weiganddef : Pat<(v2i64 (bitconvert (v2f64 VR128:$src))), (v2i64 VR128:$src)>; 1553f2968d58SUlrich Weiganddef : Pat<(v2i64 (bitconvert (f128 VR128:$src))), (v2i64 VR128:$src)>; 1554cd808237SUlrich Weigand 155580b3af7aSUlrich Weiganddef : Pat<(v4f32 (bitconvert (v16i8 VR128:$src))), (v4f32 VR128:$src)>; 155680b3af7aSUlrich Weiganddef : Pat<(v4f32 (bitconvert (v8i16 VR128:$src))), (v4f32 VR128:$src)>; 155780b3af7aSUlrich Weiganddef : Pat<(v4f32 (bitconvert (v4i32 VR128:$src))), (v4f32 VR128:$src)>; 155880b3af7aSUlrich Weiganddef : Pat<(v4f32 (bitconvert (v2i64 VR128:$src))), (v4f32 VR128:$src)>; 155980b3af7aSUlrich Weiganddef : Pat<(v4f32 (bitconvert (v2f64 VR128:$src))), (v4f32 VR128:$src)>; 1560f2968d58SUlrich Weiganddef : Pat<(v4f32 (bitconvert (f128 VR128:$src))), (v4f32 VR128:$src)>; 156180b3af7aSUlrich Weigand 1562cd808237SUlrich Weiganddef : Pat<(v2f64 (bitconvert (v16i8 VR128:$src))), (v2f64 VR128:$src)>; 1563cd808237SUlrich Weiganddef : Pat<(v2f64 (bitconvert (v8i16 VR128:$src))), (v2f64 VR128:$src)>; 1564cd808237SUlrich Weiganddef : Pat<(v2f64 (bitconvert (v4i32 VR128:$src))), (v2f64 VR128:$src)>; 1565cd808237SUlrich Weiganddef : Pat<(v2f64 (bitconvert (v2i64 VR128:$src))), (v2f64 VR128:$src)>; 156680b3af7aSUlrich Weiganddef : Pat<(v2f64 (bitconvert (v4f32 VR128:$src))), (v2f64 VR128:$src)>; 1567f2968d58SUlrich Weiganddef : Pat<(v2f64 (bitconvert (f128 VR128:$src))), (v2f64 VR128:$src)>; 1568f2968d58SUlrich Weigand 1569f2968d58SUlrich Weiganddef : Pat<(f128 (bitconvert (v16i8 VR128:$src))), (f128 VR128:$src)>; 1570f2968d58SUlrich Weiganddef : Pat<(f128 (bitconvert (v8i16 VR128:$src))), (f128 VR128:$src)>; 1571f2968d58SUlrich Weiganddef : Pat<(f128 (bitconvert (v4i32 VR128:$src))), (f128 VR128:$src)>; 1572f2968d58SUlrich Weiganddef : Pat<(f128 (bitconvert (v2i64 VR128:$src))), (f128 VR128:$src)>; 1573f2968d58SUlrich Weiganddef : Pat<(f128 (bitconvert (v4f32 VR128:$src))), (f128 VR128:$src)>; 1574f2968d58SUlrich Weiganddef : Pat<(f128 (bitconvert (v2f64 VR128:$src))), (f128 VR128:$src)>; 1575ce4c1095SUlrich Weigand 1576ce4c1095SUlrich Weigand//===----------------------------------------------------------------------===// 1577ce4c1095SUlrich Weigand// Replicating scalars 1578ce4c1095SUlrich Weigand//===----------------------------------------------------------------------===// 1579ce4c1095SUlrich Weigand 1580ce4c1095SUlrich Weigand// Define patterns for replicating a scalar GR32 into a vector of type TYPE. 1581ce4c1095SUlrich Weigand// INDEX is 8 minus the element size in bytes. 1582ce4c1095SUlrich Weigandclass VectorReplicateScalar<ValueType type, Instruction insn, bits<16> index> 1583ce4c1095SUlrich Weigand : Pat<(type (z_replicate GR32:$scalar)), 1584ce4c1095SUlrich Weigand (insn (VLVGP32 GR32:$scalar, GR32:$scalar), index)>; 1585ce4c1095SUlrich Weigand 1586ce4c1095SUlrich Weiganddef : VectorReplicateScalar<v16i8, VREPB, 7>; 1587ce4c1095SUlrich Weiganddef : VectorReplicateScalar<v8i16, VREPH, 3>; 1588ce4c1095SUlrich Weiganddef : VectorReplicateScalar<v4i32, VREPF, 1>; 1589ce4c1095SUlrich Weigand 15900312b9f5SKazuaki Ishizaki// i64 replications are just a single instruction. 1591ce4c1095SUlrich Weiganddef : Pat<(v2i64 (z_replicate GR64:$scalar)), 1592ce4c1095SUlrich Weigand (VLVGP GR64:$scalar, GR64:$scalar)>; 1593ce4c1095SUlrich Weigand 1594ce4c1095SUlrich Weigand//===----------------------------------------------------------------------===// 1595cd808237SUlrich Weigand// Floating-point insertion and extraction 1596cd808237SUlrich Weigand//===----------------------------------------------------------------------===// 1597cd808237SUlrich Weigand 159880b3af7aSUlrich Weigand// Moving 32-bit values between GPRs and FPRs can be done using VLVGF 159980b3af7aSUlrich Weigand// and VLGVF. 1600d28be373SUlrich Weigandlet Predicates = [FeatureVector] in { 160180b3af7aSUlrich Weigand def LEFR : UnaryAliasVRS<VR32, GR32>; 160280b3af7aSUlrich Weigand def LFER : UnaryAliasVRS<GR64, VR32>; 160380b3af7aSUlrich Weigand def : Pat<(f32 (bitconvert (i32 GR32:$src))), (LEFR GR32:$src)>; 160480b3af7aSUlrich Weigand def : Pat<(i32 (bitconvert (f32 VR32:$src))), 160580b3af7aSUlrich Weigand (EXTRACT_SUBREG (LFER VR32:$src), subreg_l32)>; 1606d28be373SUlrich Weigand} 160780b3af7aSUlrich Weigand 1608cd808237SUlrich Weigand// Floating-point values are stored in element 0 of the corresponding 1609cd808237SUlrich Weigand// vector register. Scalar to vector conversion is just a subreg and 1610cd808237SUlrich Weigand// scalar replication can just replicate element 0 of the vector register. 1611cd808237SUlrich Weigandmulticlass ScalarToVectorFP<Instruction vrep, ValueType vt, RegisterOperand cls, 1612cd808237SUlrich Weigand SubRegIndex subreg> { 1613cd808237SUlrich Weigand def : Pat<(vt (scalar_to_vector cls:$scalar)), 1614cd808237SUlrich Weigand (INSERT_SUBREG (vt (IMPLICIT_DEF)), cls:$scalar, subreg)>; 1615cd808237SUlrich Weigand def : Pat<(vt (z_replicate cls:$scalar)), 1616cd808237SUlrich Weigand (vrep (INSERT_SUBREG (vt (IMPLICIT_DEF)), cls:$scalar, 1617cd808237SUlrich Weigand subreg), 0)>; 1618cd808237SUlrich Weigand} 16192a119b9aSKrzysztof Parzyszekdefm : ScalarToVectorFP<VREPF, v4f32, FP32, subreg_h32>; 16202a119b9aSKrzysztof Parzyszekdefm : ScalarToVectorFP<VREPG, v2f64, FP64, subreg_h64>; 1621cd808237SUlrich Weigand 1622cd808237SUlrich Weigand// Match v2f64 insertions. The AddedComplexity counters the 3 added by 1623cd808237SUlrich Weigand// TableGen for the base register operand in VLVG-based integer insertions 1624cd808237SUlrich Weigand// and ensures that this version is strictly better. 1625cd808237SUlrich Weigandlet AddedComplexity = 4 in { 1626cd808237SUlrich Weigand def : Pat<(z_vector_insert (v2f64 VR128:$vec), FP64:$elt, 0), 1627cd808237SUlrich Weigand (VPDI (INSERT_SUBREG (v2f64 (IMPLICIT_DEF)), FP64:$elt, 16282a119b9aSKrzysztof Parzyszek subreg_h64), VR128:$vec, 1)>; 1629cd808237SUlrich Weigand def : Pat<(z_vector_insert (v2f64 VR128:$vec), FP64:$elt, 1), 1630cd808237SUlrich Weigand (VPDI VR128:$vec, (INSERT_SUBREG (v2f64 (IMPLICIT_DEF)), FP64:$elt, 16312a119b9aSKrzysztof Parzyszek subreg_h64), 0)>; 1632cd808237SUlrich Weigand} 1633cd808237SUlrich Weigand 163480b3af7aSUlrich Weigand// We extract floating-point element X by replicating (for elements other 163580b3af7aSUlrich Weigand// than 0) and then taking a high subreg. The AddedComplexity counters the 163680b3af7aSUlrich Weigand// 3 added by TableGen for the base register operand in VLGV-based integer 1637cd808237SUlrich Weigand// extractions and ensures that this version is strictly better. 1638cd808237SUlrich Weigandlet AddedComplexity = 4 in { 163980b3af7aSUlrich Weigand def : Pat<(f32 (z_vector_extract (v4f32 VR128:$vec), 0)), 16402a119b9aSKrzysztof Parzyszek (EXTRACT_SUBREG VR128:$vec, subreg_h32)>; 164180b3af7aSUlrich Weigand def : Pat<(f32 (z_vector_extract (v4f32 VR128:$vec), imm32zx2:$index)), 16422a119b9aSKrzysztof Parzyszek (EXTRACT_SUBREG (VREPF VR128:$vec, imm32zx2:$index), subreg_h32)>; 164380b3af7aSUlrich Weigand 1644cd808237SUlrich Weigand def : Pat<(f64 (z_vector_extract (v2f64 VR128:$vec), 0)), 16452a119b9aSKrzysztof Parzyszek (EXTRACT_SUBREG VR128:$vec, subreg_h64)>; 1646cd808237SUlrich Weigand def : Pat<(f64 (z_vector_extract (v2f64 VR128:$vec), imm32zx1:$index)), 16472a119b9aSKrzysztof Parzyszek (EXTRACT_SUBREG (VREPG VR128:$vec, imm32zx1:$index), subreg_h64)>; 1648cd808237SUlrich Weigand} 1649cd808237SUlrich Weigand 1650cd808237SUlrich Weigand//===----------------------------------------------------------------------===// 1651f2968d58SUlrich Weigand// Support for 128-bit floating-point values in vector registers 1652f2968d58SUlrich Weigand//===----------------------------------------------------------------------===// 1653f2968d58SUlrich Weigand 1654f2968d58SUlrich Weigandlet Predicates = [FeatureVectorEnhancements1] in { 1655f2968d58SUlrich Weigand def : Pat<(f128 (load bdxaddr12only:$addr)), 1656f2968d58SUlrich Weigand (VL bdxaddr12only:$addr)>; 1657f2968d58SUlrich Weigand def : Pat<(store (f128 VR128:$src), bdxaddr12only:$addr), 1658f2968d58SUlrich Weigand (VST VR128:$src, bdxaddr12only:$addr)>; 1659f2968d58SUlrich Weigand 1660f2968d58SUlrich Weigand def : Pat<(f128 fpimm0), (VZERO)>; 1661f2968d58SUlrich Weigand def : Pat<(f128 fpimmneg0), (WFLNXB (VZERO))>; 1662f2968d58SUlrich Weigand} 1663f2968d58SUlrich Weigand 1664f2968d58SUlrich Weigand//===----------------------------------------------------------------------===// 1665a8b04e1cSUlrich Weigand// String instructions 1666a8b04e1cSUlrich Weigand//===----------------------------------------------------------------------===// 1667a8b04e1cSUlrich Weigand 1668a8b04e1cSUlrich Weigandlet Predicates = [FeatureVector] in { 16696e31ab38SUlrich Weigand defm VFAE : TernaryOptVRRbSPairGeneric<"vfae", 0xE782>; 1670556a90c0SUlrich Weigand defm VFAEB : TernaryOptVRRbSPair<"vfaeb", 0xE782, int_s390_vfaeb, 1671556a90c0SUlrich Weigand z_vfae_cc, v128b, v128b, 0>; 1672556a90c0SUlrich Weigand defm VFAEH : TernaryOptVRRbSPair<"vfaeh", 0xE782, int_s390_vfaeh, 1673556a90c0SUlrich Weigand z_vfae_cc, v128h, v128h, 1>; 1674556a90c0SUlrich Weigand defm VFAEF : TernaryOptVRRbSPair<"vfaef", 0xE782, int_s390_vfaef, 1675556a90c0SUlrich Weigand z_vfae_cc, v128f, v128f, 2>; 1676556a90c0SUlrich Weigand defm VFAEZB : TernaryOptVRRbSPair<"vfaezb", 0xE782, int_s390_vfaezb, 1677556a90c0SUlrich Weigand z_vfaez_cc, v128b, v128b, 0, 2>; 1678556a90c0SUlrich Weigand defm VFAEZH : TernaryOptVRRbSPair<"vfaezh", 0xE782, int_s390_vfaezh, 1679556a90c0SUlrich Weigand z_vfaez_cc, v128h, v128h, 1, 2>; 1680556a90c0SUlrich Weigand defm VFAEZF : TernaryOptVRRbSPair<"vfaezf", 0xE782, int_s390_vfaezf, 1681556a90c0SUlrich Weigand z_vfaez_cc, v128f, v128f, 2, 2>; 1682a8b04e1cSUlrich Weigand 16836e31ab38SUlrich Weigand defm VFEE : BinaryExtraVRRbSPairGeneric<"vfee", 0xE780>; 1684556a90c0SUlrich Weigand defm VFEEB : BinaryExtraVRRbSPair<"vfeeb", 0xE780, int_s390_vfeeb, 1685556a90c0SUlrich Weigand z_vfee_cc, v128b, v128b, 0>; 1686556a90c0SUlrich Weigand defm VFEEH : BinaryExtraVRRbSPair<"vfeeh", 0xE780, int_s390_vfeeh, 1687556a90c0SUlrich Weigand z_vfee_cc, v128h, v128h, 1>; 1688556a90c0SUlrich Weigand defm VFEEF : BinaryExtraVRRbSPair<"vfeef", 0xE780, int_s390_vfeef, 1689556a90c0SUlrich Weigand z_vfee_cc, v128f, v128f, 2>; 1690556a90c0SUlrich Weigand defm VFEEZB : BinaryVRRbSPair<"vfeezb", 0xE780, int_s390_vfeezb, 1691556a90c0SUlrich Weigand z_vfeez_cc, v128b, v128b, 0, 2>; 1692556a90c0SUlrich Weigand defm VFEEZH : BinaryVRRbSPair<"vfeezh", 0xE780, int_s390_vfeezh, 1693556a90c0SUlrich Weigand z_vfeez_cc, v128h, v128h, 1, 2>; 1694556a90c0SUlrich Weigand defm VFEEZF : BinaryVRRbSPair<"vfeezf", 0xE780, int_s390_vfeezf, 1695556a90c0SUlrich Weigand z_vfeez_cc, v128f, v128f, 2, 2>; 1696a8b04e1cSUlrich Weigand 16976e31ab38SUlrich Weigand defm VFENE : BinaryExtraVRRbSPairGeneric<"vfene", 0xE781>; 1698556a90c0SUlrich Weigand defm VFENEB : BinaryExtraVRRbSPair<"vfeneb", 0xE781, int_s390_vfeneb, 1699556a90c0SUlrich Weigand z_vfene_cc, v128b, v128b, 0>; 1700556a90c0SUlrich Weigand defm VFENEH : BinaryExtraVRRbSPair<"vfeneh", 0xE781, int_s390_vfeneh, 1701556a90c0SUlrich Weigand z_vfene_cc, v128h, v128h, 1>; 1702556a90c0SUlrich Weigand defm VFENEF : BinaryExtraVRRbSPair<"vfenef", 0xE781, int_s390_vfenef, 1703556a90c0SUlrich Weigand z_vfene_cc, v128f, v128f, 2>; 1704c1708b26SUlrich Weigand defm VFENEZB : BinaryVRRbSPair<"vfenezb", 0xE781, int_s390_vfenezb, 1705556a90c0SUlrich Weigand z_vfenez_cc, v128b, v128b, 0, 2>; 1706c1708b26SUlrich Weigand defm VFENEZH : BinaryVRRbSPair<"vfenezh", 0xE781, int_s390_vfenezh, 1707556a90c0SUlrich Weigand z_vfenez_cc, v128h, v128h, 1, 2>; 1708c1708b26SUlrich Weigand defm VFENEZF : BinaryVRRbSPair<"vfenezf", 0xE781, int_s390_vfenezf, 1709556a90c0SUlrich Weigand z_vfenez_cc, v128f, v128f, 2, 2>; 1710a8b04e1cSUlrich Weigand 17116e31ab38SUlrich Weigand defm VISTR : UnaryExtraVRRaSPairGeneric<"vistr", 0xE75C>; 1712556a90c0SUlrich Weigand defm VISTRB : UnaryExtraVRRaSPair<"vistrb", 0xE75C, int_s390_vistrb, 1713556a90c0SUlrich Weigand z_vistr_cc, v128b, v128b, 0>; 1714556a90c0SUlrich Weigand defm VISTRH : UnaryExtraVRRaSPair<"vistrh", 0xE75C, int_s390_vistrh, 1715556a90c0SUlrich Weigand z_vistr_cc, v128h, v128h, 1>; 1716556a90c0SUlrich Weigand defm VISTRF : UnaryExtraVRRaSPair<"vistrf", 0xE75C, int_s390_vistrf, 1717556a90c0SUlrich Weigand z_vistr_cc, v128f, v128f, 2>; 1718a8b04e1cSUlrich Weigand 17196e31ab38SUlrich Weigand defm VSTRC : QuaternaryOptVRRdSPairGeneric<"vstrc", 0xE78A>; 1720556a90c0SUlrich Weigand defm VSTRCB : QuaternaryOptVRRdSPair<"vstrcb", 0xE78A, int_s390_vstrcb, 1721556a90c0SUlrich Weigand z_vstrc_cc, v128b, v128b, 0>; 1722556a90c0SUlrich Weigand defm VSTRCH : QuaternaryOptVRRdSPair<"vstrch", 0xE78A, int_s390_vstrch, 1723556a90c0SUlrich Weigand z_vstrc_cc, v128h, v128h, 1>; 1724556a90c0SUlrich Weigand defm VSTRCF : QuaternaryOptVRRdSPair<"vstrcf", 0xE78A, int_s390_vstrcf, 1725556a90c0SUlrich Weigand z_vstrc_cc, v128f, v128f, 2>; 1726556a90c0SUlrich Weigand defm VSTRCZB : QuaternaryOptVRRdSPair<"vstrczb", 0xE78A, int_s390_vstrczb, 1727c1708b26SUlrich Weigand z_vstrcz_cc, v128b, v128b, 0, 2>; 1728556a90c0SUlrich Weigand defm VSTRCZH : QuaternaryOptVRRdSPair<"vstrczh", 0xE78A, int_s390_vstrczh, 1729c1708b26SUlrich Weigand z_vstrcz_cc, v128h, v128h, 1, 2>; 1730556a90c0SUlrich Weigand defm VSTRCZF : QuaternaryOptVRRdSPair<"vstrczf", 0xE78A, int_s390_vstrczf, 1731c1708b26SUlrich Weigand z_vstrcz_cc, v128f, v128f, 2, 2>; 1732a8b04e1cSUlrich Weigand} 17332b3482feSUlrich Weigand 17340f0a8b77SUlrich Weigandlet Predicates = [FeatureVectorEnhancements2] in { 17350f0a8b77SUlrich Weigand defm VSTRS : TernaryExtraVRRdGeneric<"vstrs", 0xE78B>; 17360f0a8b77SUlrich Weigand defm VSTRSB : TernaryExtraVRRd<"vstrsb", 0xE78B, 17370f0a8b77SUlrich Weigand z_vstrs_cc, v128b, v128b, 0>; 17380f0a8b77SUlrich Weigand defm VSTRSH : TernaryExtraVRRd<"vstrsh", 0xE78B, 17390f0a8b77SUlrich Weigand z_vstrs_cc, v128b, v128h, 1>; 17400f0a8b77SUlrich Weigand defm VSTRSF : TernaryExtraVRRd<"vstrsf", 0xE78B, 17410f0a8b77SUlrich Weigand z_vstrs_cc, v128b, v128f, 2>; 17420f0a8b77SUlrich Weigand let Defs = [CC] in { 17430f0a8b77SUlrich Weigand def VSTRSZB : TernaryVRRd<"vstrszb", 0xE78B, 17440f0a8b77SUlrich Weigand z_vstrsz_cc, v128b, v128b, 0, 2>; 17450f0a8b77SUlrich Weigand def VSTRSZH : TernaryVRRd<"vstrszh", 0xE78B, 17460f0a8b77SUlrich Weigand z_vstrsz_cc, v128b, v128h, 1, 2>; 17470f0a8b77SUlrich Weigand def VSTRSZF : TernaryVRRd<"vstrszf", 0xE78B, 17480f0a8b77SUlrich Weigand z_vstrsz_cc, v128b, v128f, 2, 2>; 17490f0a8b77SUlrich Weigand } 17500f0a8b77SUlrich Weigand} 17510f0a8b77SUlrich Weigand 17522b3482feSUlrich Weigand//===----------------------------------------------------------------------===// 1753*8cd8120aSUlrich Weigand// NNP assist instructions 1754*8cd8120aSUlrich Weigand//===----------------------------------------------------------------------===// 1755*8cd8120aSUlrich Weigand 1756*8cd8120aSUlrich Weigandlet Predicates = [FeatureVector, FeatureNNPAssist] in { 1757*8cd8120aSUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1 in 1758*8cd8120aSUlrich Weigand def VCFN : UnaryVRRaFloatGeneric<"vcfn", 0xE65D>; 1759*8cd8120aSUlrich Weigand def : Pat<(int_s390_vcfn VR128:$x, imm32zx4_timm:$m), 1760*8cd8120aSUlrich Weigand (VCFN VR128:$x, 1, imm32zx4:$m)>; 1761*8cd8120aSUlrich Weigand 1762*8cd8120aSUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1 in 1763*8cd8120aSUlrich Weigand def VCLFNL : UnaryVRRaFloatGeneric<"vclfnl", 0xE65E>; 1764*8cd8120aSUlrich Weigand def : Pat<(int_s390_vclfnls VR128:$x, imm32zx4_timm:$m), 1765*8cd8120aSUlrich Weigand (VCLFNL VR128:$x, 2, imm32zx4:$m)>; 1766*8cd8120aSUlrich Weigand 1767*8cd8120aSUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1 in 1768*8cd8120aSUlrich Weigand def VCLFNH : UnaryVRRaFloatGeneric<"vclfnh", 0xE656>; 1769*8cd8120aSUlrich Weigand def : Pat<(int_s390_vclfnhs VR128:$x, imm32zx4_timm:$m), 1770*8cd8120aSUlrich Weigand (VCLFNH VR128:$x, 2, imm32zx4:$m)>; 1771*8cd8120aSUlrich Weigand 1772*8cd8120aSUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1 in 1773*8cd8120aSUlrich Weigand def VCNF : UnaryVRRaFloatGeneric<"vcnf", 0xE655>; 1774*8cd8120aSUlrich Weigand def : Pat<(int_s390_vcnf VR128:$x, imm32zx4_timm:$m), 1775*8cd8120aSUlrich Weigand (VCNF VR128:$x, imm32zx4:$m, 1)>; 1776*8cd8120aSUlrich Weigand 1777*8cd8120aSUlrich Weigand let Uses = [FPC], mayRaiseFPException = 1 in 1778*8cd8120aSUlrich Weigand def VCRNF : BinaryVRRcFloatGeneric<"vcrnf", 0xE675>; 1779*8cd8120aSUlrich Weigand def : Pat<(int_s390_vcrnfs VR128:$x, VR128:$y, imm32zx4_timm:$m), 1780*8cd8120aSUlrich Weigand (VCRNF VR128:$x, VR128:$y, imm32zx4:$m, 2)>; 1781*8cd8120aSUlrich Weigand} 1782*8cd8120aSUlrich Weigand 1783*8cd8120aSUlrich Weigand//===----------------------------------------------------------------------===// 17842b3482feSUlrich Weigand// Packed-decimal instructions 17852b3482feSUlrich Weigand//===----------------------------------------------------------------------===// 17862b3482feSUlrich Weigand 17872b3482feSUlrich Weigandlet Predicates = [FeatureVectorPackedDecimal] in { 17882b3482feSUlrich Weigand def VLIP : BinaryVRIh<"vlip", 0xE649>; 17892b3482feSUlrich Weigand 17902b3482feSUlrich Weigand def VPKZ : BinaryVSI<"vpkz", 0xE634, null_frag, 0>; 17912b3482feSUlrich Weigand def VUPKZ : StoreLengthVSI<"vupkz", 0xE63C, null_frag, 0>; 17922b3482feSUlrich Weigand 17932b3482feSUlrich Weigand let Defs = [CC] in { 17940f0a8b77SUlrich Weigand let Predicates = [FeatureVectorPackedDecimalEnhancement] in { 17950f0a8b77SUlrich Weigand def VCVBOpt : TernaryVRRi<"vcvb", 0xE650, GR32>; 17960f0a8b77SUlrich Weigand def VCVBGOpt : TernaryVRRi<"vcvbg", 0xE652, GR64>; 17970f0a8b77SUlrich Weigand } 17982b3482feSUlrich Weigand def VCVB : BinaryVRRi<"vcvb", 0xE650, GR32>; 17992b3482feSUlrich Weigand def VCVBG : BinaryVRRi<"vcvbg", 0xE652, GR64>; 18002b3482feSUlrich Weigand def VCVD : TernaryVRIi<"vcvd", 0xE658, GR32>; 18012b3482feSUlrich Weigand def VCVDG : TernaryVRIi<"vcvdg", 0xE65A, GR64>; 18022b3482feSUlrich Weigand 18032b3482feSUlrich Weigand def VAP : QuaternaryVRIf<"vap", 0xE671>; 18042b3482feSUlrich Weigand def VSP : QuaternaryVRIf<"vsp", 0xE673>; 18052b3482feSUlrich Weigand 18062b3482feSUlrich Weigand def VMP : QuaternaryVRIf<"vmp", 0xE678>; 18072b3482feSUlrich Weigand def VMSP : QuaternaryVRIf<"vmsp", 0xE679>; 18082b3482feSUlrich Weigand 18092b3482feSUlrich Weigand def VDP : QuaternaryVRIf<"vdp", 0xE67A>; 18102b3482feSUlrich Weigand def VRP : QuaternaryVRIf<"vrp", 0xE67B>; 18112b3482feSUlrich Weigand def VSDP : QuaternaryVRIf<"vsdp", 0xE67E>; 18122b3482feSUlrich Weigand 18132b3482feSUlrich Weigand def VSRP : QuaternaryVRIg<"vsrp", 0xE659>; 18142b3482feSUlrich Weigand def VPSOP : QuaternaryVRIg<"vpsop", 0xE65B>; 18152b3482feSUlrich Weigand 18162b3482feSUlrich Weigand def VTP : TestVRRg<"vtp", 0xE65F>; 18172b3482feSUlrich Weigand def VCP : CompareVRRh<"vcp", 0xE677>; 18182b3482feSUlrich Weigand } 18192b3482feSUlrich Weigand} 1820*8cd8120aSUlrich Weigand 1821*8cd8120aSUlrich Weigandlet Predicates = [FeatureVectorPackedDecimalEnhancement2] in { 1822*8cd8120aSUlrich Weigand def VSCHP : BinaryExtraVRRbGeneric<"vschp", 0xE674>; 1823*8cd8120aSUlrich Weigand def VSCHSP : BinaryExtraVRRb<"vschsp", 0xE674, 2>; 1824*8cd8120aSUlrich Weigand def VSCHDP : BinaryExtraVRRb<"vschdp", 0xE674, 3>; 1825*8cd8120aSUlrich Weigand def VSCHXP : BinaryExtraVRRb<"vschxp", 0xE674, 4>; 1826*8cd8120aSUlrich Weigand 1827*8cd8120aSUlrich Weigand def VSCSHP : BinaryVRRb<"vscshp", 0xE67C, null_frag, v128b, v128b>; 1828*8cd8120aSUlrich Weigand 1829*8cd8120aSUlrich Weigand def VCSPH : TernaryVRRj<"vcsph", 0xE67D>; 1830*8cd8120aSUlrich Weigand 1831*8cd8120aSUlrich Weigand let Defs = [CC] in 1832*8cd8120aSUlrich Weigand def VCLZDP : BinaryVRRk<"vclzdp", 0xE651>; 1833*8cd8120aSUlrich Weigand 1834*8cd8120aSUlrich Weigand let Defs = [CC] in 1835*8cd8120aSUlrich Weigand def VSRPR : QuaternaryVRIf<"vsrpr", 0xE672>; 1836*8cd8120aSUlrich Weigand 1837*8cd8120aSUlrich Weigand let Defs = [CC] in { 1838*8cd8120aSUlrich Weigand def VPKZR : QuaternaryVRIf<"vpkzr", 0xE670>; 1839*8cd8120aSUlrich Weigand def VUPKZH : BinaryVRRk<"vupkzh", 0xE654>; 1840*8cd8120aSUlrich Weigand def VUPKZL : BinaryVRRk<"vupkzl", 0xE65C>; 1841*8cd8120aSUlrich Weigand } 1842*8cd8120aSUlrich Weigand} 1843