1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 12:02:58 +02:00
llvm-mirror/test/CodeGen/WebAssembly/load.ll
Dan Gohman 63ce1aa222 [WebAssembly] Switch to MC for instruction printing.
This encompasses several changes which are all interconnected:
 - Use the MC framework for printing almost all instructions.
 - AsmStrings are now live.
 - This introduces an indirection between LLVM vregs and WebAssembly registers,
   and a new pass, WebAssemblyRegNumbering, for computing a basic the mapping.
   This addresses some basic issues with argument registers and unused registers.
 - The way ARGUMENT instructions are handled no longer generates redundant
   get_local+set_local for every argument.

This also changes the assembly syntax somewhat; most notably, MC's printing
use sigils on label names, so those are no longer present, and push/pop now
have a sigil to keep them unambiguous.

The usage of set_local/get_local/$push/$pop will continue to evolve
significantly. This patch is just one step of a larger change.

llvm-svn: 252858
2015-11-12 06:10:03 +00:00

55 lines
1.4 KiB
LLVM

; RUN: llc < %s -asm-verbose=false | FileCheck %s
; Test that basic loads are assembled properly.
target datalayout = "e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
; CHECK-LABEL: ldi32:
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32, i32{{$}}
; CHECK-NEXT: i32.load $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
define i32 @ldi32(i32 *%p) {
%v = load i32, i32* %p
ret i32 %v
}
; CHECK-LABEL: ldi64:
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i64{{$}}
; CHECK-NEXT: .local i32, i64{{$}}
; CHECK-NEXT: i64.load $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
define i64 @ldi64(i64 *%p) {
%v = load i64, i64* %p
ret i64 %v
}
; CHECK-LABEL: ldf32:
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result f32{{$}}
; CHECK-NEXT: .local i32, f32{{$}}
; CHECK-NEXT: f32.load $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
define float @ldf32(float *%p) {
%v = load float, float* %p
ret float %v
}
; CHECK-LABEL: ldf64:
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result f64{{$}}
; CHECK-NEXT: .local i32, f64{{$}}
; CHECK-NEXT: f64.load $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
define double @ldf64(double *%p) {
%v = load double, double* %p
ret double %v
}