|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 |
| 2 | +; RUN: llc < %s --mtriple=wasm32-unknown-unknown -mcpu=mvp -mattr=+reference-types | FileCheck --check-prefixes CHECK,CHK32 %s |
| 3 | +; RUN: llc < %s --mtriple=wasm64-unknown-unknown -mcpu=mvp -mattr=+reference-types | FileCheck --check-prefixes CHECK,CHK64 %s |
| 4 | + |
| 5 | +define void @test_fpsig_void_void(ptr noundef %func) local_unnamed_addr #0 { |
| 6 | +; CHECK-LABEL: test_fpsig_void_void: |
| 7 | +; CHK32: .functype test_fpsig_void_void (i32) -> () |
| 8 | +; CHK64: .functype test_fpsig_void_void (i64) -> () |
| 9 | +; CHECK-NEXT: # %bb.0: # %entry |
| 10 | +; CHECK-NEXT: local.get 0 |
| 11 | +; CHECK-NEXT: table.get __indirect_function_table |
| 12 | +; CHECK-NEXT: ref.test () -> () |
| 13 | +; CHECK-NEXT: call use |
| 14 | +; CHECK-NEXT: # fallthrough-return |
| 15 | +entry: |
| 16 | + %res = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func) |
| 17 | + tail call void @use(i32 noundef %res) #3 |
| 18 | + ret void |
| 19 | +} |
| 20 | + |
| 21 | +define void @test_fpsig_return_i32(ptr noundef %func) local_unnamed_addr #0 { |
| 22 | +; CHECK-LABEL: test_fpsig_return_i32: |
| 23 | +; CHK32: .functype test_fpsig_return_i32 (i32) -> () |
| 24 | +; CHK64: .functype test_fpsig_return_i32 (i64) -> () |
| 25 | +; CHECK-NEXT: # %bb.0: # %entry |
| 26 | +; CHECK-NEXT: local.get 0 |
| 27 | +; CHECK-NEXT: table.get __indirect_function_table |
| 28 | +; CHECK-NEXT: ref.test () -> (i32) |
| 29 | +; CHECK-NEXT: call use |
| 30 | +; CHECK-NEXT: # fallthrough-return |
| 31 | +entry: |
| 32 | + %res = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, i32 0) |
| 33 | + tail call void @use(i32 noundef %res) #3 |
| 34 | + ret void |
| 35 | +} |
| 36 | + |
| 37 | +define void @test_fpsig_return_i64(ptr noundef %func) local_unnamed_addr #0 { |
| 38 | +; CHECK-LABEL: test_fpsig_return_i64: |
| 39 | +; CHK32: .functype test_fpsig_return_i64 (i32) -> () |
| 40 | +; CHK64: .functype test_fpsig_return_i64 (i64) -> () |
| 41 | +; CHECK-NEXT: # %bb.0: # %entry |
| 42 | +; CHECK-NEXT: local.get 0 |
| 43 | +; CHECK-NEXT: table.get __indirect_function_table |
| 44 | +; CHECK-NEXT: ref.test () -> (i64) |
| 45 | +; CHECK-NEXT: call use |
| 46 | +; CHECK-NEXT: # fallthrough-return |
| 47 | +entry: |
| 48 | + %res = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, i64 0) |
| 49 | + tail call void @use(i32 noundef %res) #3 |
| 50 | + ret void |
| 51 | +} |
| 52 | + |
| 53 | +define void @test_fpsig_return_f32(ptr noundef %func) local_unnamed_addr #0 { |
| 54 | +; CHECK-LABEL: test_fpsig_return_f32: |
| 55 | +; CHK32: .functype test_fpsig_return_f32 (i32) -> () |
| 56 | +; CHK64: .functype test_fpsig_return_f32 (i64) -> () |
| 57 | +; CHECK-NEXT: # %bb.0: # %entry |
| 58 | +; CHECK-NEXT: local.get 0 |
| 59 | +; CHECK-NEXT: table.get __indirect_function_table |
| 60 | +; CHECK-NEXT: ref.test () -> (f32) |
| 61 | +; CHECK-NEXT: call use |
| 62 | +; CHECK-NEXT: # fallthrough-return |
| 63 | +entry: |
| 64 | + %res = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, float 0.) |
| 65 | + tail call void @use(i32 noundef %res) #3 |
| 66 | + ret void |
| 67 | +} |
| 68 | + |
| 69 | +define void @test_fpsig_return_f64(ptr noundef %func) local_unnamed_addr #0 { |
| 70 | +; CHECK-LABEL: test_fpsig_return_f64: |
| 71 | +; CHK32: .functype test_fpsig_return_f64 (i32) -> () |
| 72 | +; CHK64: .functype test_fpsig_return_f64 (i64) -> () |
| 73 | +; CHECK-NEXT: # %bb.0: # %entry |
| 74 | +; CHECK-NEXT: local.get 0 |
| 75 | +; CHECK-NEXT: table.get __indirect_function_table |
| 76 | +; CHECK-NEXT: ref.test () -> (f64) |
| 77 | +; CHECK-NEXT: call use |
| 78 | +; CHECK-NEXT: # fallthrough-return |
| 79 | +entry: |
| 80 | + %res = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, double 0.) |
| 81 | + tail call void @use(i32 noundef %res) #3 |
| 82 | + ret void |
| 83 | +} |
| 84 | + |
| 85 | + |
| 86 | +define void @test_fpsig_param_i32(ptr noundef %func) local_unnamed_addr #0 { |
| 87 | +; CHECK-LABEL: test_fpsig_param_i32: |
| 88 | +; CHK32: .functype test_fpsig_param_i32 (i32) -> () |
| 89 | +; CHK64: .functype test_fpsig_param_i32 (i64) -> () |
| 90 | +; CHECK-NEXT: # %bb.0: # %entry |
| 91 | +; CHECK-NEXT: local.get 0 |
| 92 | +; CHECK-NEXT: table.get __indirect_function_table |
| 93 | +; CHECK-NEXT: ref.test (f64) -> () |
| 94 | +; CHECK-NEXT: call use |
| 95 | +; CHECK-NEXT: # fallthrough-return |
| 96 | +entry: |
| 97 | + %res = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, token poison, double 0.) |
| 98 | + tail call void @use(i32 noundef %res) #3 |
| 99 | + ret void |
| 100 | +} |
| 101 | + |
| 102 | + |
| 103 | +define void @test_fpsig_multiple_params_and_returns(ptr noundef %func) local_unnamed_addr #0 { |
| 104 | +; CHECK-LABEL: test_fpsig_multiple_params_and_returns: |
| 105 | +; CHK32: .functype test_fpsig_multiple_params_and_returns (i32) -> () |
| 106 | +; CHK64: .functype test_fpsig_multiple_params_and_returns (i64) -> () |
| 107 | +; CHECK-NEXT: # %bb.0: # %entry |
| 108 | +; CHECK-NEXT: local.get 0 |
| 109 | +; CHECK-NEXT: table.get __indirect_function_table |
| 110 | +; CHECK-NEXT: ref.test (i64, f32, i64) -> (i32, i64, f32, f64) |
| 111 | +; CHECK-NEXT: call use |
| 112 | +; CHECK-NEXT: # fallthrough-return |
| 113 | +entry: |
| 114 | + %res = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, i32 0, i64 0, float 0., double 0., token poison, i64 0, float 0., i64 0) |
| 115 | + tail call void @use(i32 noundef %res) #3 |
| 116 | + ret void |
| 117 | +} |
| 118 | + |
| 119 | + |
| 120 | +declare void @use(i32 noundef) local_unnamed_addr #1 |
0 commit comments