xref: /llvm-project/llvm/test/CodeGen/RISCV/zmmul.ll (revision 3198364e6e4943512ed48f2a1c1ab4c418b72f42)
1*3198364eSksyx; RUN: llc -mtriple=riscv32 -mattr=+zmmul -verify-machineinstrs < %s \
2*3198364eSksyx; RUN:  | not FileCheck -check-prefix=CHECK-DIV %s
3*3198364eSksyx; RUN: llc -mtriple=riscv64 -mattr=+zmmul -verify-machineinstrs < %s \
4*3198364eSksyx; RUN:  | not FileCheck -check-prefix=CHECK-DIV %s
5*3198364eSksyx; RUN: llc -mtriple=riscv32 -mattr=+zmmul -verify-machineinstrs < %s \
6*3198364eSksyx; RUN:  | not FileCheck -check-prefix=CHECK-REM %s
7*3198364eSksyx; RUN: llc -mtriple=riscv64 -mattr=+zmmul -verify-machineinstrs < %s \
8*3198364eSksyx; RUN:  | not FileCheck -check-prefix=CHECK-REM %s
9*3198364eSksyx
10*3198364eSksyx; RUN: llc -mtriple=riscv32 -mattr=+zmmul -verify-machineinstrs < %s \
11*3198364eSksyx; RUN:  | not FileCheck -check-prefix=CHECK-UDIV %s
12*3198364eSksyx; RUN: llc -mtriple=riscv64 -mattr=+zmmul -verify-machineinstrs < %s \
13*3198364eSksyx; RUN:  | not FileCheck -check-prefix=CHECK-UDIV %s
14*3198364eSksyx; RUN: llc -mtriple=riscv32 -mattr=+zmmul -verify-machineinstrs < %s \
15*3198364eSksyx; RUN:  | not FileCheck -check-prefix=CHECK-UREM %s
16*3198364eSksyx; RUN: llc -mtriple=riscv64 -mattr=+zmmul -verify-machineinstrs < %s \
17*3198364eSksyx; RUN:  | not FileCheck -check-prefix=CHECK-UREM %s
18*3198364eSksyx
19*3198364eSksyx; RUN: llc -mtriple=riscv32 -mattr=+zmmul -verify-machineinstrs < %s \
20*3198364eSksyx; RUN:  | FileCheck -check-prefix=CHECK-MUL %s
21*3198364eSksyx; RUN: llc -mtriple=riscv64 -mattr=+zmmul -verify-machineinstrs < %s \
22*3198364eSksyx; RUN:  | FileCheck -check-prefix=CHECK-MUL %s
23*3198364eSksyx
24*3198364eSksyx; RUN: llc -mtriple=riscv32 -mattr=+m -verify-machineinstrs < %s \
25*3198364eSksyx; RUN:  | FileCheck -check-prefixes=CHECK-MUL,CHECK-UDIV,CHECK-DIV,CHECK-UREM,CHECK-REM %s
26*3198364eSksyx; RUN: llc -mtriple=riscv64 -mattr=+m -verify-machineinstrs < %s \
27*3198364eSksyx; RUN:  | FileCheck -check-prefixes=CHECK-MUL,CHECK-UDIV,CHECK-DIV,CHECK-UREM,CHECK-REM %s
28*3198364eSksyx
29*3198364eSksyxdefine i32 @foo(i32 %a, i32 %b) {
30*3198364eSksyx; CHECK-UDIV: divu{{w?}} {{[as]}}{{[0-9]}}, {{[as]}}{{[0-9]}}, {{[as]}}{{[0-9]}}
31*3198364eSksyx  %1 = udiv i32 %a, %b
32*3198364eSksyx; CHECK-DIV: div{{w?}} {{[as]}}{{[0-9]}}, {{[as]}}{{[0-9]}}, {{[as]}}{{[0-9]}}
33*3198364eSksyx  %2 = sdiv i32 %a, %1
34*3198364eSksyx; CHECK-MUL: mul{{w?}} {{[as]}}{{[0-9]}}, {{[as]}}{{[0-9]}}, {{[as]}}{{[0-9]}}
35*3198364eSksyx  %3 = mul i32 %b, %2
36*3198364eSksyx; CHECK-UREM: remu{{w?}} {{[as]}}{{[0-9]}}, {{[as]}}{{[0-9]}}, {{[as]}}{{[0-9]}}
37*3198364eSksyx  %4 = urem i32 %3, %b
38*3198364eSksyx; CHECK-REM: rem{{w?}} {{[as]}}{{[0-9]}}, {{[as]}}{{[0-9]}}, {{[as]}}{{[0-9]}}
39*3198364eSksyx  %5 = srem i32 %4, %a
40*3198364eSksyx  ret i32 %5
41*3198364eSksyx}
42