1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 12:43:36 +01:00
llvm-mirror/test/CodeGen/RISCV/rv32zbr.ll
Levy Hsu deb679e8ad [RISCV] Add IR intrinsic for Zbr extension
Implementation for RISC-V Zbr extension intrinsic.

Header files are included in separate patch in case the name needs to be changed

RV32 / 64:
        crc32b
        crc32h
        crc32w
        crc32cb
        crc32ch
        crc32cw

RV64 Only:
        crc32d
        crc32cd

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D99009
2021-04-02 10:58:45 -07:00

70 lines
1.7 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=riscv32 -mattr=experimental-zbr -verify-machineinstrs < %s \
; RUN: | FileCheck %s -check-prefix=RV32ZBR
declare i32 @llvm.riscv.crc32.b.i32(i32)
define i32 @crc32b(i32 %a) nounwind {
; RV32ZBR-LABEL: crc32b:
; RV32ZBR: # %bb.0:
; RV32ZBR-NEXT: crc32.b a0, a0
; RV32ZBR-NEXT: ret
%tmp = call i32 @llvm.riscv.crc32.b.i32(i32 %a)
ret i32 %tmp
}
declare i32 @llvm.riscv.crc32.h.i32(i32)
define i32 @crc32h(i32 %a) nounwind {
; RV32ZBR-LABEL: crc32h:
; RV32ZBR: # %bb.0:
; RV32ZBR-NEXT: crc32.h a0, a0
; RV32ZBR-NEXT: ret
%tmp = call i32 @llvm.riscv.crc32.h.i32(i32 %a)
ret i32 %tmp
}
declare i32 @llvm.riscv.crc32.w.i32(i32)
define i32 @crc32w(i32 %a) nounwind {
; RV32ZBR-LABEL: crc32w:
; RV32ZBR: # %bb.0:
; RV32ZBR-NEXT: crc32.w a0, a0
; RV32ZBR-NEXT: ret
%tmp = call i32 @llvm.riscv.crc32.w.i32(i32 %a)
ret i32 %tmp
}
declare i32 @llvm.riscv.crc32c.b.i32(i32)
define i32 @crc32cb(i32 %a) nounwind {
; RV32ZBR-LABEL: crc32cb:
; RV32ZBR: # %bb.0:
; RV32ZBR-NEXT: crc32c.b a0, a0
; RV32ZBR-NEXT: ret
%tmp = call i32 @llvm.riscv.crc32c.b.i32(i32 %a)
ret i32 %tmp
}
declare i32 @llvm.riscv.crc32c.h.i32(i32)
define i32 @crc32ch(i32 %a) nounwind {
; RV32ZBR-LABEL: crc32ch:
; RV32ZBR: # %bb.0:
; RV32ZBR-NEXT: crc32c.h a0, a0
; RV32ZBR-NEXT: ret
%tmp = call i32 @llvm.riscv.crc32c.h.i32(i32 %a)
ret i32 %tmp
}
declare i32 @llvm.riscv.crc32c.w.i32(i32)
define i32 @crc32cw(i32 %a) nounwind {
; RV32ZBR-LABEL: crc32cw:
; RV32ZBR: # %bb.0:
; RV32ZBR-NEXT: crc32c.w a0, a0
; RV32ZBR-NEXT: ret
%tmp = call i32 @llvm.riscv.crc32c.w.i32(i32 %a)
ret i32 %tmp
}