Skip to content

Commit

Permalink
[WebAssembly] Preliminary fast-isel support.
Browse files Browse the repository at this point in the history
llvm-svn: 269083
  • Loading branch information
Dan Gohman committed May 10, 2016
1 parent 0f522a5 commit 2e64438
Show file tree
Hide file tree
Showing 9 changed files with 580 additions and 9 deletions.
546 changes: 542 additions & 4 deletions llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions llvm/test/CodeGen/WebAssembly/cfg-stackify.ll
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
; RUN: llc < %s -asm-verbose=false -disable-block-placement -verify-machineinstrs | FileCheck %s
; RUN: llc < %s -asm-verbose=false -verify-machineinstrs | FileCheck -check-prefix=OPT %s
; RUN: llc < %s -asm-verbose=false -disable-block-placement -verify-machineinstrs -fast-isel=false | FileCheck %s
; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -fast-isel=false | FileCheck -check-prefix=OPT %s

; Test the CFG stackifier pass.

; Explicitly disable fast-isel, since it gets implicitly enabled in the
; optnone test.

target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"

Expand Down
28 changes: 28 additions & 0 deletions llvm/test/CodeGen/WebAssembly/fast-isel.ll
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,31 @@ define float @immediate_f32() {
define double @immediate_f64() {
ret double 2.5
}

; CHECK-LABEL: bitcast_i32_f32:
; CHECK: i32.reinterpret/f32 $push{{[0-9]+}}=, $0{{$}}
define i32 @bitcast_i32_f32(float %x) {
%y = bitcast float %x to i32
ret i32 %y
}

; CHECK-LABEL: bitcast_f32_i32:
; CHECK: f32.reinterpret/i32 $push{{[0-9]+}}=, $0{{$}}
define float @bitcast_f32_i32(i32 %x) {
%y = bitcast i32 %x to float
ret float %y
}

; CHECK-LABEL: bitcast_i64_f64:
; CHECK: i64.reinterpret/f64 $push{{[0-9]+}}=, $0{{$}}
define i64 @bitcast_i64_f64(double %x) {
%y = bitcast double %x to i64
ret i64 %y
}

; CHECK-LABEL: bitcast_f64_i64:
; CHECK: f64.reinterpret/i64 $push{{[0-9]+}}=, $0{{$}}
define double @bitcast_f64_i64(i64 %x) {
%y = bitcast i64 %x to double
ret double %y
}
1 change: 1 addition & 0 deletions llvm/test/CodeGen/WebAssembly/load.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
; RUN: llc < %s -asm-verbose=false | FileCheck %s
; RUN: llc < %s -asm-verbose=false -fast-isel -fast-isel-abort=1 | FileCheck %s

; Test that basic loads are assembled properly.

Expand Down
1 change: 1 addition & 0 deletions llvm/test/CodeGen/WebAssembly/return-int32.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
; RUN: llc < %s -asm-verbose=false | FileCheck %s
; RUN: llc < %s -asm-verbose=false -fast-isel -fast-isel-abort=1 | FileCheck %s

target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
Expand Down
1 change: 1 addition & 0 deletions llvm/test/CodeGen/WebAssembly/return-void.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
; RUN: llc < %s -asm-verbose=false | FileCheck %s
; RUN: llc < %s -asm-verbose=false -fast-isel -fast-isel-abort=1 | FileCheck %s

target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
Expand Down
1 change: 1 addition & 0 deletions llvm/test/CodeGen/WebAssembly/store.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
; RUN: llc < %s -asm-verbose=false | FileCheck %s
; RUN: llc < %s -asm-verbose=false -fast-isel -fast-isel-abort=1 | FileCheck %s

; Test that basic stores are assembled properly.

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/WebAssembly/unreachable.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; RUN: llc < %s -asm-verbose=false -verify-machineinstrs | FileCheck %s
; RUN: llc < %s -asm-verbose=false -fast-isel -verify-machineinstrs | FileCheck %s
; RUN: llc < %s -asm-verbose=false -fast-isel -fast-isel-abort=1 -verify-machineinstrs | FileCheck %s

; Test that LLVM unreachable instruction and trap intrinsic are lowered to
; wasm unreachable
Expand Down
2 changes: 0 additions & 2 deletions llvm/test/CodeGen/WebAssembly/userstack.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
; RUN: llc < %s -asm-verbose=false | FileCheck %s
; RUN: llc < %s -asm-verbose=false -fast-isel | FileCheck %s


target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
Expand Down

0 comments on commit 2e64438

Please sign in to comment.