mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
[WebAssembly] Update opcode name format for conversions
Summary: Conversion opcode name format should be f64.convert_u/i64 not f64_convert_u Author: s3ththompson Reviewers: jfb Subscribers: sunfish, jfb, llvm-commits, dschuff Differential Revision: http://reviews.llvm.org/D14160 llvm-svn: 251613
This commit is contained in:
parent
38040ca6f9
commit
4d52083a07
@ -96,7 +96,8 @@ private:
|
||||
// Operand type (if any), followed by the lower-case version of the opcode's
|
||||
// name matching the names WebAssembly opcodes are expected to have. The
|
||||
// tablegen names are uppercase and suffixed with their type (after an
|
||||
// underscore).
|
||||
// underscore). Conversions are additionally prefixed with their input type
|
||||
// (before a double underscore).
|
||||
static std::string OpcodeName(const WebAssemblyInstrInfo *TII,
|
||||
const MachineInstr *MI) {
|
||||
std::string N(StringRef(TII->getName(MI->getOpcode())).lower());
|
||||
@ -110,7 +111,14 @@ static std::string OpcodeName(const WebAssemblyInstrInfo *TII,
|
||||
for (const char *typelessOpcode : { "return", "call", "br_if" })
|
||||
if (Name == typelessOpcode)
|
||||
return Name;
|
||||
return std::string(&N[NameEnd + 1], &N[Len]) + '.' + Name;
|
||||
std::string Type(&N[NameEnd + 1], &N[Len]);
|
||||
std::string::size_type DoubleUnder = Name.find("__");
|
||||
bool IsConv = std::string::npos != DoubleUnder;
|
||||
if (!IsConv)
|
||||
return Type + '.' + Name;
|
||||
std::string InType(&Name[0], &Name[DoubleUnder]);
|
||||
return Type + '.' + std::string(&Name[DoubleUnder + 2], &Name[NameEnd]) +
|
||||
'/' + InType;
|
||||
}
|
||||
|
||||
static std::string toSymbol(StringRef S) { return ("$" + S).str(); }
|
||||
|
@ -13,58 +13,58 @@
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
def I32_WRAP_I64 : I<(outs I32:$dst), (ins I64:$src),
|
||||
def I64__WRAP_I32 : I<(outs I32:$dst), (ins I64:$src),
|
||||
[(set I32:$dst, (trunc I64:$src))]>;
|
||||
|
||||
def I64_EXTEND_S_I32 : I<(outs I64:$dst), (ins I32:$src),
|
||||
def I32__EXTEND_S_I64 : I<(outs I64:$dst), (ins I32:$src),
|
||||
[(set I64:$dst, (sext I32:$src))]>;
|
||||
def I64_EXTEND_U_I32 : I<(outs I64:$dst), (ins I32:$src),
|
||||
def I32__EXTEND_U_I64 : I<(outs I64:$dst), (ins I32:$src),
|
||||
[(set I64:$dst, (zext I32:$src))]>;
|
||||
|
||||
def I32_TRUNC_S_F32 : I<(outs I32:$dst), (ins F32:$src),
|
||||
def F32__TRUNC_S_I32 : I<(outs I32:$dst), (ins F32:$src),
|
||||
[(set I32:$dst, (fp_to_sint F32:$src))]>;
|
||||
def I32_TRUNC_U_F32 : I<(outs I32:$dst), (ins F32:$src),
|
||||
def F32__TRUNC_U_I32 : I<(outs I32:$dst), (ins F32:$src),
|
||||
[(set I32:$dst, (fp_to_uint F32:$src))]>;
|
||||
def I64_TRUNC_S_F32 : I<(outs I64:$dst), (ins F32:$src),
|
||||
def F32__TRUNC_S_I64 : I<(outs I64:$dst), (ins F32:$src),
|
||||
[(set I64:$dst, (fp_to_sint F32:$src))]>;
|
||||
def I64_TRUNC_U_F32 : I<(outs I64:$dst), (ins F32:$src),
|
||||
def F32__TRUNC_U_I64 : I<(outs I64:$dst), (ins F32:$src),
|
||||
[(set I64:$dst, (fp_to_uint F32:$src))]>;
|
||||
def I32_TRUNC_S_F64 : I<(outs I32:$dst), (ins F64:$src),
|
||||
def F64__TRUNC_S_I32 : I<(outs I32:$dst), (ins F64:$src),
|
||||
[(set I32:$dst, (fp_to_sint F64:$src))]>;
|
||||
def I32_TRUNC_U_F64 : I<(outs I32:$dst), (ins F64:$src),
|
||||
def F64__TRUNC_U_I32 : I<(outs I32:$dst), (ins F64:$src),
|
||||
[(set I32:$dst, (fp_to_uint F64:$src))]>;
|
||||
def I64_TRUNC_S_F64 : I<(outs I64:$dst), (ins F64:$src),
|
||||
def F64__TRUNC_S_I64 : I<(outs I64:$dst), (ins F64:$src),
|
||||
[(set I64:$dst, (fp_to_sint F64:$src))]>;
|
||||
def I64_TRUNC_U_F64 : I<(outs I64:$dst), (ins F64:$src),
|
||||
def F64__TRUNC_U_I64 : I<(outs I64:$dst), (ins F64:$src),
|
||||
[(set I64:$dst, (fp_to_uint F64:$src))]>;
|
||||
|
||||
def F32_CONVERT_S_I32 : I<(outs F32:$dst), (ins I32:$src),
|
||||
def I32__CONVERT_S_F32 : I<(outs F32:$dst), (ins I32:$src),
|
||||
[(set F32:$dst, (sint_to_fp I32:$src))]>;
|
||||
def F32_CONVERT_U_I32 : I<(outs F32:$dst), (ins I32:$src),
|
||||
def I32__CONVERT_U_F32 : I<(outs F32:$dst), (ins I32:$src),
|
||||
[(set F32:$dst, (uint_to_fp I32:$src))]>;
|
||||
def F64_CONVERT_S_I32 : I<(outs F64:$dst), (ins I32:$src),
|
||||
def I32__CONVERT_S_F64 : I<(outs F64:$dst), (ins I32:$src),
|
||||
[(set F64:$dst, (sint_to_fp I32:$src))]>;
|
||||
def F64_CONVERT_U_I32 : I<(outs F64:$dst), (ins I32:$src),
|
||||
def I32__CONVERT_U_F64 : I<(outs F64:$dst), (ins I32:$src),
|
||||
[(set F64:$dst, (uint_to_fp I32:$src))]>;
|
||||
def F32_CONVERT_S_I64 : I<(outs F32:$dst), (ins I64:$src),
|
||||
def I64__CONVERT_S_F32 : I<(outs F32:$dst), (ins I64:$src),
|
||||
[(set F32:$dst, (sint_to_fp I64:$src))]>;
|
||||
def F32_CONVERT_U_I64 : I<(outs F32:$dst), (ins I64:$src),
|
||||
def I64__CONVERT_U_F32 : I<(outs F32:$dst), (ins I64:$src),
|
||||
[(set F32:$dst, (uint_to_fp I64:$src))]>;
|
||||
def F64_CONVERT_S_I64 : I<(outs F64:$dst), (ins I64:$src),
|
||||
def I64__CONVERT_S_F64 : I<(outs F64:$dst), (ins I64:$src),
|
||||
[(set F64:$dst, (sint_to_fp I64:$src))]>;
|
||||
def F64_CONVERT_U_I64 : I<(outs F64:$dst), (ins I64:$src),
|
||||
def I64__CONVERT_U_F64 : I<(outs F64:$dst), (ins I64:$src),
|
||||
[(set F64:$dst, (uint_to_fp I64:$src))]>;
|
||||
|
||||
def F64_PROMOTE_F32 : I<(outs F64:$dst), (ins F32:$src),
|
||||
def F32__PROMOTE_F64 : I<(outs F64:$dst), (ins F32:$src),
|
||||
[(set F64:$dst, (fextend F32:$src))]>;
|
||||
def F32_DEMOTE_F64 : I<(outs F32:$dst), (ins F64:$src),
|
||||
def F64__DEMOTE_F32 : I<(outs F32:$dst), (ins F64:$src),
|
||||
[(set F32:$dst, (fround F64:$src))]>;
|
||||
|
||||
def I32_REINTERPRET_F32 : I<(outs I32:$dst), (ins F32:$src),
|
||||
def F32__REINTERPRET_I32 : I<(outs I32:$dst), (ins F32:$src),
|
||||
[(set I32:$dst, (bitconvert F32:$src))]>;
|
||||
def F32_REINTERPRET_I32 : I<(outs F32:$dst), (ins I32:$src),
|
||||
def I32__REINTERPRET_F32 : I<(outs F32:$dst), (ins I32:$src),
|
||||
[(set F32:$dst, (bitconvert I32:$src))]>;
|
||||
def I64_REINTERPRET_F64 : I<(outs I64:$dst), (ins F64:$src),
|
||||
def F64__REINTERPRET_I64 : I<(outs I64:$dst), (ins F64:$src),
|
||||
[(set I64:$dst, (bitconvert F64:$src))]>;
|
||||
def F64_REINTERPRET_I64 : I<(outs F64:$dst), (ins I64:$src),
|
||||
def I64__REINTERPRET_F64 : I<(outs F64:$dst), (ins I64:$src),
|
||||
[(set F64:$dst, (bitconvert I64:$src))]>;
|
||||
|
@ -11,7 +11,7 @@ target triple = "wasm32-unknown-unknown"
|
||||
; CHECK-NEXT: .local i64, i32{{$}}
|
||||
; CHECK-NEXT: get_local 0{{$}}
|
||||
; CHECK-NEXT: set_local 1, pop{{$}}
|
||||
; CHECK-NEXT: i32_wrap (get_local 1){{$}}
|
||||
; CHECK-NEXT: i32.wrap/i64 (get_local 1){{$}}
|
||||
; CHECK-NEXT: set_local 2, pop{{$}}
|
||||
; CHECK-NEXT: return (get_local 2){{$}}
|
||||
define i32 @i32_wrap_i64(i64 %x) {
|
||||
@ -25,7 +25,7 @@ define i32 @i32_wrap_i64(i64 %x) {
|
||||
; CHECK-NEXT: .local i32, i64{{$}}
|
||||
; CHECK-NEXT: get_local 0{{$}}
|
||||
; CHECK-NEXT: set_local 1, pop{{$}}
|
||||
; CHECK-NEXT: i64_extend_s (get_local 1){{$}}
|
||||
; CHECK-NEXT: i64.extend_s/i32 (get_local 1){{$}}
|
||||
; CHECK-NEXT: set_local 2, pop{{$}}
|
||||
; CHECK-NEXT: return (get_local 2){{$}}
|
||||
define i64 @i64_extend_s_i32(i32 %x) {
|
||||
@ -39,7 +39,7 @@ define i64 @i64_extend_s_i32(i32 %x) {
|
||||
; CHECK-NEXT: .local i32, i64{{$}}
|
||||
; CHECK-NEXT: get_local 0{{$}}
|
||||
; CHECK-NEXT: set_local 1, pop{{$}}
|
||||
; CHECK-NEXT: i64_extend_u (get_local 1){{$}}
|
||||
; CHECK-NEXT: i64.extend_u/i32 (get_local 1){{$}}
|
||||
; CHECK-NEXT: set_local 2, pop{{$}}
|
||||
; CHECK-NEXT: return (get_local 2){{$}}
|
||||
define i64 @i64_extend_u_i32(i32 %x) {
|
||||
@ -53,7 +53,7 @@ define i64 @i64_extend_u_i32(i32 %x) {
|
||||
; CHECK-NEXT: .local f32, i32{{$}}
|
||||
; CHECK-NEXT: get_local 0{{$}}
|
||||
; CHECK-NEXT: set_local 1, pop{{$}}
|
||||
; CHECK-NEXT: i32_trunc_s (get_local 1){{$}}
|
||||
; CHECK-NEXT: i32.trunc_s/f32 (get_local 1){{$}}
|
||||
; CHECK-NEXT: set_local 2, pop{{$}}
|
||||
; CHECK-NEXT: return (get_local 2){{$}}
|
||||
define i32 @i32_trunc_s_f32(float %x) {
|
||||
@ -67,7 +67,7 @@ define i32 @i32_trunc_s_f32(float %x) {
|
||||
; CHECK-NEXT: .local f32, i32{{$}}
|
||||
; CHECK-NEXT: get_local 0{{$}}
|
||||
; CHECK-NEXT: set_local 1, pop{{$}}
|
||||
; CHECK-NEXT: i32_trunc_u (get_local 1){{$}}
|
||||
; CHECK-NEXT: i32.trunc_u/f32 (get_local 1){{$}}
|
||||
; CHECK-NEXT: set_local 2, pop{{$}}
|
||||
; CHECK-NEXT: return (get_local 2){{$}}
|
||||
define i32 @i32_trunc_u_f32(float %x) {
|
||||
@ -81,7 +81,7 @@ define i32 @i32_trunc_u_f32(float %x) {
|
||||
; CHECK-NEXT: .local f64, i32{{$}}
|
||||
; CHECK-NEXT: get_local 0{{$}}
|
||||
; CHECK-NEXT: set_local 1, pop{{$}}
|
||||
; CHECK-NEXT: i32_trunc_s (get_local 1){{$}}
|
||||
; CHECK-NEXT: i32.trunc_s/f64 (get_local 1){{$}}
|
||||
; CHECK-NEXT: set_local 2, pop{{$}}
|
||||
; CHECK-NEXT: return (get_local 2){{$}}
|
||||
define i32 @i32_trunc_s_f64(double %x) {
|
||||
@ -95,7 +95,7 @@ define i32 @i32_trunc_s_f64(double %x) {
|
||||
; CHECK-NEXT: .local f64, i32{{$}}
|
||||
; CHECK-NEXT: get_local 0{{$}}
|
||||
; CHECK-NEXT: set_local 1, pop{{$}}
|
||||
; CHECK-NEXT: i32_trunc_u (get_local 1){{$}}
|
||||
; CHECK-NEXT: i32.trunc_u/f64 (get_local 1){{$}}
|
||||
; CHECK-NEXT: set_local 2, pop{{$}}
|
||||
; CHECK-NEXT: return (get_local 2){{$}}
|
||||
define i32 @i32_trunc_u_f64(double %x) {
|
||||
@ -109,7 +109,7 @@ define i32 @i32_trunc_u_f64(double %x) {
|
||||
; CHECK-NEXT: .local f32, i64{{$}}
|
||||
; CHECK-NEXT: get_local 0{{$}}
|
||||
; CHECK-NEXT: set_local 1, pop{{$}}
|
||||
; CHECK-NEXT: i64_trunc_s (get_local 1){{$}}
|
||||
; CHECK-NEXT: i64.trunc_s/f32 (get_local 1){{$}}
|
||||
; CHECK-NEXT: set_local 2, pop{{$}}
|
||||
; CHECK-NEXT: return (get_local 2){{$}}
|
||||
define i64 @i64_trunc_s_f32(float %x) {
|
||||
@ -123,7 +123,7 @@ define i64 @i64_trunc_s_f32(float %x) {
|
||||
; CHECK-NEXT: .local f32, i64{{$}}
|
||||
; CHECK-NEXT: get_local 0{{$}}
|
||||
; CHECK-NEXT: set_local 1, pop{{$}}
|
||||
; CHECK-NEXT: i64_trunc_u (get_local 1){{$}}
|
||||
; CHECK-NEXT: i64.trunc_u/f32 (get_local 1){{$}}
|
||||
; CHECK-NEXT: set_local 2, pop{{$}}
|
||||
; CHECK-NEXT: return (get_local 2){{$}}
|
||||
define i64 @i64_trunc_u_f32(float %x) {
|
||||
@ -137,7 +137,7 @@ define i64 @i64_trunc_u_f32(float %x) {
|
||||
; CHECK-NEXT: .local f64, i64{{$}}
|
||||
; CHECK-NEXT: get_local 0{{$}}
|
||||
; CHECK-NEXT: set_local 1, pop{{$}}
|
||||
; CHECK-NEXT: i64_trunc_s (get_local 1){{$}}
|
||||
; CHECK-NEXT: i64.trunc_s/f64 (get_local 1){{$}}
|
||||
; CHECK-NEXT: set_local 2, pop{{$}}
|
||||
; CHECK-NEXT: return (get_local 2){{$}}
|
||||
define i64 @i64_trunc_s_f64(double %x) {
|
||||
@ -151,7 +151,7 @@ define i64 @i64_trunc_s_f64(double %x) {
|
||||
; CHECK-NEXT: .local f64, i64{{$}}
|
||||
; CHECK-NEXT: get_local 0{{$}}
|
||||
; CHECK-NEXT: set_local 1, pop{{$}}
|
||||
; CHECK-NEXT: i64_trunc_u (get_local 1){{$}}
|
||||
; CHECK-NEXT: i64.trunc_u/f64 (get_local 1){{$}}
|
||||
; CHECK-NEXT: set_local 2, pop{{$}}
|
||||
; CHECK-NEXT: return (get_local 2){{$}}
|
||||
define i64 @i64_trunc_u_f64(double %x) {
|
||||
@ -165,7 +165,7 @@ define i64 @i64_trunc_u_f64(double %x) {
|
||||
; CHECK-NEXT: .local i32, f32{{$}}
|
||||
; CHECK-NEXT: get_local 0{{$}}
|
||||
; CHECK-NEXT: set_local 1, pop{{$}}
|
||||
; CHECK-NEXT: f32_convert_s (get_local 1){{$}}
|
||||
; CHECK-NEXT: f32.convert_s/i32 (get_local 1){{$}}
|
||||
; CHECK-NEXT: set_local 2, pop{{$}}
|
||||
; CHECK-NEXT: return (get_local 2){{$}}
|
||||
define float @f32_convert_s_i32(i32 %x) {
|
||||
@ -179,7 +179,7 @@ define float @f32_convert_s_i32(i32 %x) {
|
||||
; CHECK-NEXT: .local i32, f32{{$}}
|
||||
; CHECK-NEXT: get_local 0{{$}}
|
||||
; CHECK-NEXT: set_local 1, pop{{$}}
|
||||
; CHECK-NEXT: f32_convert_u (get_local 1){{$}}
|
||||
; CHECK-NEXT: f32.convert_u/i32 (get_local 1){{$}}
|
||||
; CHECK-NEXT: set_local 2, pop{{$}}
|
||||
; CHECK-NEXT: return (get_local 2){{$}}
|
||||
define float @f32_convert_u_i32(i32 %x) {
|
||||
@ -193,7 +193,7 @@ define float @f32_convert_u_i32(i32 %x) {
|
||||
; CHECK-NEXT: .local i32, f64{{$}}
|
||||
; CHECK-NEXT: get_local 0{{$}}
|
||||
; CHECK-NEXT: set_local 1, pop{{$}}
|
||||
; CHECK-NEXT: f64_convert_s (get_local 1){{$}}
|
||||
; CHECK-NEXT: f64.convert_s/i32 (get_local 1){{$}}
|
||||
; CHECK-NEXT: set_local 2, pop{{$}}
|
||||
; CHECK-NEXT: return (get_local 2){{$}}
|
||||
define double @f64_convert_s_i32(i32 %x) {
|
||||
@ -207,7 +207,7 @@ define double @f64_convert_s_i32(i32 %x) {
|
||||
; CHECK-NEXT: .local i32, f64{{$}}
|
||||
; CHECK-NEXT: get_local 0{{$}}
|
||||
; CHECK-NEXT: set_local 1, pop{{$}}
|
||||
; CHECK-NEXT: f64_convert_u (get_local 1){{$}}
|
||||
; CHECK-NEXT: f64.convert_u/i32 (get_local 1){{$}}
|
||||
; CHECK-NEXT: set_local 2, pop{{$}}
|
||||
; CHECK-NEXT: return (get_local 2){{$}}
|
||||
define double @f64_convert_u_i32(i32 %x) {
|
||||
@ -221,7 +221,7 @@ define double @f64_convert_u_i32(i32 %x) {
|
||||
; CHECK-NEXT: .local i64, f32{{$}}
|
||||
; CHECK-NEXT: get_local 0{{$}}
|
||||
; CHECK-NEXT: set_local 1, pop{{$}}
|
||||
; CHECK-NEXT: f32_convert_s (get_local 1){{$}}
|
||||
; CHECK-NEXT: f32.convert_s/i64 (get_local 1){{$}}
|
||||
; CHECK-NEXT: set_local 2, pop{{$}}
|
||||
; CHECK-NEXT: return (get_local 2){{$}}
|
||||
define float @f32_convert_s_i64(i64 %x) {
|
||||
@ -235,7 +235,7 @@ define float @f32_convert_s_i64(i64 %x) {
|
||||
; CHECK-NEXT: .local i64, f32{{$}}
|
||||
; CHECK-NEXT: get_local 0{{$}}
|
||||
; CHECK-NEXT: set_local 1, pop{{$}}
|
||||
; CHECK-NEXT: f32_convert_u (get_local 1){{$}}
|
||||
; CHECK-NEXT: f32.convert_u/i64 (get_local 1){{$}}
|
||||
; CHECK-NEXT: set_local 2, pop{{$}}
|
||||
; CHECK-NEXT: return (get_local 2){{$}}
|
||||
define float @f32_convert_u_i64(i64 %x) {
|
||||
@ -249,7 +249,7 @@ define float @f32_convert_u_i64(i64 %x) {
|
||||
; CHECK-NEXT: .local i64, f64{{$}}
|
||||
; CHECK-NEXT: get_local 0{{$}}
|
||||
; CHECK-NEXT: set_local 1, pop{{$}}
|
||||
; CHECK-NEXT: f64_convert_s (get_local 1){{$}}
|
||||
; CHECK-NEXT: f64.convert_s/i64 (get_local 1){{$}}
|
||||
; CHECK-NEXT: set_local 2, pop{{$}}
|
||||
; CHECK-NEXT: return (get_local 2){{$}}
|
||||
define double @f64_convert_s_i64(i64 %x) {
|
||||
@ -263,7 +263,7 @@ define double @f64_convert_s_i64(i64 %x) {
|
||||
; CHECK-NEXT: .local i64, f64{{$}}
|
||||
; CHECK-NEXT: get_local 0{{$}}
|
||||
; CHECK-NEXT: set_local 1, pop{{$}}
|
||||
; CHECK-NEXT: f64_convert_u (get_local 1){{$}}
|
||||
; CHECK-NEXT: f64.convert_u/i64 (get_local 1){{$}}
|
||||
; CHECK-NEXT: set_local 2, pop{{$}}
|
||||
; CHECK-NEXT: return (get_local 2){{$}}
|
||||
define double @f64_convert_u_i64(i64 %x) {
|
||||
@ -277,7 +277,7 @@ define double @f64_convert_u_i64(i64 %x) {
|
||||
; CHECK-NEXT: .local f32, f64{{$}}
|
||||
; CHECK-NEXT: get_local 0{{$}}
|
||||
; CHECK-NEXT: set_local 1, pop{{$}}
|
||||
; CHECK-NEXT: f64_promote (get_local 1){{$}}
|
||||
; CHECK-NEXT: f64.promote/f32 (get_local 1){{$}}
|
||||
; CHECK-NEXT: set_local 2, pop{{$}}
|
||||
; CHECK-NEXT: return (get_local 2){{$}}
|
||||
define double @f64_promote_f32(float %x) {
|
||||
@ -291,7 +291,7 @@ define double @f64_promote_f32(float %x) {
|
||||
; CHECK-NEXT: .local f64, f32{{$}}
|
||||
; CHECK-NEXT: get_local 0{{$}}
|
||||
; CHECK-NEXT: set_local 1, pop{{$}}
|
||||
; CHECK-NEXT: f32_demote (get_local 1){{$}}
|
||||
; CHECK-NEXT: f32.demote/f64 (get_local 1){{$}}
|
||||
; CHECK-NEXT: set_local 2, pop{{$}}
|
||||
; CHECK-NEXT: return (get_local 2){{$}}
|
||||
define float @f32_demote_f64(double %x) {
|
||||
|
Loading…
Reference in New Issue
Block a user