Index: llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td =================================================================== --- llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td +++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td @@ -18,14 +18,15 @@ def LaneIdx#SIZE : ImmLeaf; // lane extraction -multiclass ExtractLane simdop, - SDNode extract = vector_extract> { - defm "" : SIMD_I<(outs reg_t:$dst), (ins V128:$vec, I32:$idx), - (outs), (ins I32:$idx), - [(set reg_t:$dst, - (extract (vec_t V128:$vec), (i32 imm_t:$idx)))], - name#"\t$dst, $vec, $idx", name#"\t$idx", simdop>; +multiclass ExtractLane simdop, + string suffix = "", SDNode extract = vector_extract> { + defm EXTRACT_LANE_#vec_t#suffix : + SIMD_I<(outs reg_t:$dst), (ins V128:$vec, I32:$idx), + (outs), (ins I32:$idx), + [(set reg_t:$dst, (extract (vec_t V128:$vec), (i32 imm_t:$idx)))], + vec#".extract_lane"#suffix#"\t$dst, $vec, $idx", + vec#".extract_lane"#suffix#"\t$idx", simdop>; } multiclass ExtractPat { def _s : PatFrag<(ops node:$vec, node:$idx), @@ -48,43 +49,36 @@ defm extract_i8x16 : ExtractPat; defm extract_i16x8 : ExtractPat; multiclass ExtractLaneExtended baseInst> { - defm _I8x16 : ExtractLane("extract_i8x16"#sign)>; - defm _I16x8 : ExtractLane("extract_i16x8"#sign)>; + defm "" : ExtractLane("extract_i8x16"#sign)>; + defm "" : ExtractLane("extract_i16x8"#sign)>; } let Defs = [ARGUMENTS] in { -defm EXTRACT_LANE_S : ExtractLaneExtended<"_s", 9>; -defm EXTRACT_LANE_U : ExtractLaneExtended<"_u", 10>; -defm EXTRACT_LANE_I32x4 : - ExtractLane; -defm EXTRACT_LANE_I64x2 : - ExtractLane; -defm EXTRACT_LANE_F32x4 : - ExtractLane; -defm EXTRACT_LANE_F64x2 : - ExtractLane; +defm "" : ExtractLaneExtended<"_s", 9>; +defm "" : ExtractLaneExtended<"_u", 10>; +defm "" : ExtractLane; +defm "" : ExtractLane; +defm "" : ExtractLane; +defm "" : ExtractLane; } // Defs = [ARGUMENTS] // follow convention of making implicit expansions unsigned def : Pat<(i32 (vector_extract (v16i8 V128:$vec), (i32 LaneIdx16:$idx))), - (EXTRACT_LANE_U_I8x16 V128:$vec, (i32 LaneIdx16:$idx))>; + (EXTRACT_LANE_v16i8_u V128:$vec, (i32 LaneIdx16:$idx))>; def : Pat<(i32 (vector_extract (v8i16 V128:$vec), (i32 LaneIdx8:$idx))), - (EXTRACT_LANE_U_I16x8 V128:$vec, (i32 LaneIdx8:$idx))>; + (EXTRACT_LANE_v8i16_u V128:$vec, (i32 LaneIdx8:$idx))>; // lane replacement multiclass ReplaceLane simdop> { - defm REPLACE_LANE_#vec_t : SIMD_I<(outs V128:$dst), - (ins V128:$vec, I32:$idx, reg_t:$x), - (outs), (ins I32:$idx), - [(set V128:$dst, (vector_insert - (vec_t V128:$vec), - (lane_t reg_t:$x), - (i32 imm_t:$idx)))], - vec#".replace_lane\t$dst, $vec, $idx, $x", - vec#".replace_lane\t$idx", simdop>; + defm REPLACE_LANE_#vec_t : + SIMD_I<(outs V128:$dst), (ins V128:$vec, I32:$idx, reg_t:$x), + (outs), (ins I32:$idx), + [(set V128:$dst, (vector_insert + (vec_t V128:$vec), (lane_t reg_t:$x), (i32 imm_t:$idx)))], + vec#".replace_lane\t$dst, $vec, $idx, $x", + vec#".replace_lane\t$idx", simdop>; } let Defs = [ARGUMENTS] in { defm "" : ReplaceLane; @@ -107,11 +101,11 @@ node:$x, node:$x, node:$x, node:$x, node:$x, node:$x, node:$x, node:$x, node:$x, node:$x, node:$x, node:$x)>; -multiclass Splat simdop> { defm SPLAT_#vec_t : SIMD_I<(outs V128:$dst), (ins reg_t:$x), (outs), (ins), [(set (vec_t V128:$dst), (splat_pat reg_t:$x))], - name#".splat\t$dst, $x", name#".splat", simdop>; + vec#".splat\t$dst, $x", vec#".splat", simdop>; } let Defs = [ARGUMENTS] in { defm "" : Splat;