xref: /aosp_15_r20/external/llvm/test/CodeGen/WebAssembly/frem.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt | FileCheck %s
2
3; Test that the frem instruction works.
4
5target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
6target triple = "wasm32-unknown-unknown"
7
8; CHECK-LABEL: frem32:
9; CHECK-NEXT: .param f32, f32{{$}}
10; CHECK-NEXT: .result f32{{$}}
11; CHECK-NEXT: {{^}} f32.call $push0=, fmodf@FUNCTION, $0, $1{{$}}
12; CHECK-NEXT: return $pop0{{$}}
13define float @frem32(float %x, float %y) {
14  %a = frem float %x, %y
15  ret float %a
16}
17
18; CHECK-LABEL: frem64:
19; CHECK-NEXT: .param f64, f64{{$}}
20; CHECK-NEXT: .result f64{{$}}
21; CHECK-NEXT: {{^}} f64.call $push0=, fmod@FUNCTION, $0, $1{{$}}
22; CHECK-NEXT: return $pop0{{$}}
23define double @frem64(double %x, double %y) {
24  %a = frem double %x, %y
25  ret double %a
26}
27