mirror of
https://github.com/RPCSX/llvm.git
synced 2025-04-15 14:40:03 +00:00

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 does not 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252910 91177308-0d34-0410-b5e6-96231b3b80d8
48 lines
1.5 KiB
LLVM
48 lines
1.5 KiB
LLVM
; RUN: llc < %s -asm-verbose=false | FileCheck %s
|
|
; RUN: llc < %s -asm-verbose=false -fast-isel | FileCheck %s
|
|
|
|
; Test that wasm select instruction is selected from LLVM select instruction.
|
|
|
|
target datalayout = "e-p:32:32-i64:64-n32:64-S128"
|
|
target triple = "wasm32-unknown-unknown"
|
|
|
|
; CHECK-LABEL: select_i32:
|
|
; CHECK: i32.eq $push, (get_local 2), (get_local 3)
|
|
; CHECK: set_local 4, $pop
|
|
; CHECK: i32.select $push, (get_local 4), (get_local 0), (get_local 1)
|
|
define i32 @select_i32(i32 %a, i32 %b, i32 %cond) {
|
|
%cc = icmp eq i32 %cond, 0
|
|
%result = select i1 %cc, i32 %a, i32 %b
|
|
ret i32 %result
|
|
}
|
|
|
|
; CHECK-LABEL: select_i64:
|
|
; CHECK: i32.eq $push, (get_local 2), (get_local 3)
|
|
; CHECK: set_local 4, $pop
|
|
; CHECK: i64.select $push, (get_local 4), (get_local 0), (get_local 1)
|
|
define i64 @select_i64(i64 %a, i64 %b, i32 %cond) {
|
|
%cc = icmp eq i32 %cond, 0
|
|
%result = select i1 %cc, i64 %a, i64 %b
|
|
ret i64 %result
|
|
}
|
|
|
|
; CHECK-LABEL: select_f32:
|
|
; CHECK: i32.eq $push, (get_local 2), (get_local 3)
|
|
; CHECK: set_local 4, $pop
|
|
; CHECK: f32.select $push, (get_local 4), (get_local 0), (get_local 1)
|
|
define float @select_f32(float %a, float %b, i32 %cond) {
|
|
%cc = icmp eq i32 %cond, 0
|
|
%result = select i1 %cc, float %a, float %b
|
|
ret float %result
|
|
}
|
|
|
|
; CHECK-LABEL: select_f64:
|
|
; CHECK: i32.eq $push, (get_local 2), (get_local 3)
|
|
; CHECK: set_local 4, $pop
|
|
; CHECK: f64.select $push, (get_local 4), (get_local 0), (get_local 1)
|
|
define double @select_f64(double %a, double %b, i32 %cond) {
|
|
%cc = icmp eq i32 %cond, 0
|
|
%result = select i1 %cc, double %a, double %b
|
|
ret double %result
|
|
}
|