[InstCombine] Signed saturation patterns
[llvm-core.git] / test / CodeGen / WebAssembly / indirect-import.ll
blobeea1ce8222175dc7a78a06fde0a8290fd9327e45
1 ; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-keep-registers -verify-machineinstrs | FileCheck %s
2 ; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-keep-registers -verify-machineinstrs -fast-isel | FileCheck %s
4 ; ModuleID = 'test/dot_s/indirect-import.c'
5 source_filename = "test/dot_s/indirect-import.c"
6 target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
7 target triple = "wasm32"
9 %struct.big = type { float, double, i32 }
11 ; Function Attrs: nounwind
12 ; CHECK-LABEL: bar:
13 define hidden i32 @bar() #0 {
14 entry:
15   %fd = alloca float (double)*, align 4
16   %vj = alloca void (i64)*, align 4
17   %v = alloca void ()*, align 4
18   %ijidf = alloca i32 (i64, i32, double, float)*, align 4
19   %vs = alloca void (%struct.big*)*, align 4
20   %s = alloca void (%struct.big*)*, align 4
21   %i128ret = alloca i128 (i64)*, align 8
23 ; CHECK-DAG: i32.const       {{.+}}=, extern_fd
24 ; CHECK-DAG: i32.const       {{.+}}=, extern_vj
25   store float (double)* @extern_fd, float (double)** %fd, align 4
26   store void (i64)* @extern_vj, void (i64)** %vj, align 4
27   %0 = load void (i64)*, void (i64)** %vj, align 4
28   call void %0(i64 1)
30 ; CHECK: i32.const       {{.+}}=, extern_v
31   store void ()* @extern_v, void ()** %v, align 4
32   %1 = load void ()*, void ()** %v, align 4
33   call void %1()
35 ; CHECK: i32.const       {{.+}}=, extern_ijidf
36   store i32 (i64, i32, double, float)* @extern_ijidf, i32 (i64, i32, double, float)** %ijidf, align 4
37   %2 = load i32 (i64, i32, double, float)*, i32 (i64, i32, double, float)** %ijidf, align 4
38   %call = call i32 %2(i64 1, i32 2, double 3.000000e+00, float 4.000000e+00)
40 ; CHECK-DAG: i32.const       {{.+}}=, extern_struct
41 ; CHECK-DAG: i32.const       {{.+}}=, extern_sret
42   store void (%struct.big*)* @extern_struct, void (%struct.big*)** %vs, align 4
43   store void (%struct.big*)* @extern_sret, void (%struct.big*)** %s, align 4
44   %3 = load float (double)*, float (double)** %fd, align 4
45   %4 = ptrtoint float (double)* %3 to i32
47 ; CHECK: i32.const       {{.+}}=, extern_i128ret
48   store i128 (i64)* @extern_i128ret, i128 (i64)** %i128ret, align 8
49   %5 = load i128 (i64)*, i128 (i64)** %i128ret, align 8
50   %6 = call i128 %5(i64 1)
52   ret i32 %4
55 declare float @extern_fd(double) #1
57 declare void @extern_vj(i64) #1
59 declare void @extern_v() #1
61 declare i32 @extern_ijidf(i64, i32, double, float) #1
63 declare void @extern_struct(%struct.big* byval align 8) #1
65 declare void @extern_sret(%struct.big* sret) #1
67 declare i128 @extern_i128ret(i64) #1
69 attributes #0 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" }
70 attributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" }
73 ; CHECK: .functype extern_fd (f64) -> (f32)
74 ; CHECK: .functype extern_vj (i64) -> ()
75 ; CHECK: .functype extern_v () -> ()
76 ; CHECK: .functype extern_ijidf  (i64, i32, f64, f32) -> (i32)
77 ; CHECK: .functype extern_struct (i32) -> ()
78 ; CHECK: .functype extern_sret (i32) -> ()
79 ; CHECK: .functype extern_i128ret (i32, i64) -> ()