Skip to content

Commit

Permalink
[RISCV] Add Zbp command lines to bswap-bitreverse.ll. NFC
Browse files Browse the repository at this point in the history
  • Loading branch information
topperc committed Mar 13, 2022
1 parent e3550f1 commit b55a77d
Showing 1 changed file with 140 additions and 0 deletions.
140 changes: 140 additions & 0 deletions llvm/test/CodeGen/RISCV/bswap-bitreverse.ll
Expand Up @@ -11,6 +11,10 @@
; RUN: | FileCheck %s -check-prefixes=RV32ZB,RV32ZBKB
; RUN: llc -mtriple=riscv64 -mattr=+zbkb -verify-machineinstrs < %s \
; RUN: | FileCheck %s -check-prefixes=RV64ZB,RV64ZBKB
; RUN: llc -mtriple=riscv32 -mattr=+experimental-zbp -verify-machineinstrs < %s \
; RUN: | FileCheck %s -check-prefixes=RV32ZBP
; RUN: llc -mtriple=riscv64 -mattr=+experimental-zbp -verify-machineinstrs < %s \
; RUN: | FileCheck %s -check-prefixes=RV64ZBP

declare i16 @llvm.bswap.i16(i16)
declare i32 @llvm.bswap.i32(i32)
Expand Down Expand Up @@ -48,6 +52,16 @@ define i16 @test_bswap_i16(i16 %a) nounwind {
; RV64ZB-NEXT: rev8 a0, a0
; RV64ZB-NEXT: srli a0, a0, 48
; RV64ZB-NEXT: ret
;
; RV32ZBP-LABEL: test_bswap_i16:
; RV32ZBP: # %bb.0:
; RV32ZBP-NEXT: rev8.h a0, a0
; RV32ZBP-NEXT: ret
;
; RV64ZBP-LABEL: test_bswap_i16:
; RV64ZBP: # %bb.0:
; RV64ZBP-NEXT: rev8.h a0, a0
; RV64ZBP-NEXT: ret
%tmp = call i16 @llvm.bswap.i16(i16 %a)
ret i16 %tmp
}
Expand Down Expand Up @@ -95,6 +109,16 @@ define i32 @test_bswap_i32(i32 %a) nounwind {
; RV64ZB-NEXT: rev8 a0, a0
; RV64ZB-NEXT: srli a0, a0, 32
; RV64ZB-NEXT: ret
;
; RV32ZBP-LABEL: test_bswap_i32:
; RV32ZBP: # %bb.0:
; RV32ZBP-NEXT: rev8 a0, a0
; RV32ZBP-NEXT: ret
;
; RV64ZBP-LABEL: test_bswap_i32:
; RV64ZBP: # %bb.0:
; RV64ZBP-NEXT: rev8.w a0, a0
; RV64ZBP-NEXT: ret
%tmp = call i32 @llvm.bswap.i32(i32 %a)
ret i32 %tmp
}
Expand Down Expand Up @@ -169,6 +193,18 @@ define i64 @test_bswap_i64(i64 %a) nounwind {
; RV64ZB: # %bb.0:
; RV64ZB-NEXT: rev8 a0, a0
; RV64ZB-NEXT: ret
;
; RV32ZBP-LABEL: test_bswap_i64:
; RV32ZBP: # %bb.0:
; RV32ZBP-NEXT: rev8 a2, a1
; RV32ZBP-NEXT: rev8 a1, a0
; RV32ZBP-NEXT: mv a0, a2
; RV32ZBP-NEXT: ret
;
; RV64ZBP-LABEL: test_bswap_i64:
; RV64ZBP: # %bb.0:
; RV64ZBP-NEXT: rev8 a0, a0
; RV64ZBP-NEXT: ret
%tmp = call i64 @llvm.bswap.i64(i64 %a)
ret i64 %tmp
}
Expand Down Expand Up @@ -263,6 +299,16 @@ define i8 @test_bitreverse_i8(i8 %a) nounwind {
; RV64ZBKB-NEXT: brev8 a0, a0
; RV64ZBKB-NEXT: srli a0, a0, 56
; RV64ZBKB-NEXT: ret
;
; RV32ZBP-LABEL: test_bitreverse_i8:
; RV32ZBP: # %bb.0:
; RV32ZBP-NEXT: rev.b a0, a0
; RV32ZBP-NEXT: ret
;
; RV64ZBP-LABEL: test_bitreverse_i8:
; RV64ZBP: # %bb.0:
; RV64ZBP-NEXT: rev.b a0, a0
; RV64ZBP-NEXT: ret
%tmp = call i8 @llvm.bitreverse.i8(i8 %a)
ret i8 %tmp
}
Expand Down Expand Up @@ -391,6 +437,16 @@ define i16 @test_bitreverse_i16(i16 %a) nounwind {
; RV64ZBKB-NEXT: brev8 a0, a0
; RV64ZBKB-NEXT: srli a0, a0, 48
; RV64ZBKB-NEXT: ret
;
; RV32ZBP-LABEL: test_bitreverse_i16:
; RV32ZBP: # %bb.0:
; RV32ZBP-NEXT: rev.h a0, a0
; RV32ZBP-NEXT: ret
;
; RV64ZBP-LABEL: test_bitreverse_i16:
; RV64ZBP: # %bb.0:
; RV64ZBP-NEXT: rev.h a0, a0
; RV64ZBP-NEXT: ret
%tmp = call i16 @llvm.bitreverse.i16(i16 %a)
ret i16 %tmp
}
Expand Down Expand Up @@ -537,6 +593,16 @@ define i32 @test_bitreverse_i32(i32 %a) nounwind {
; RV64ZBKB-NEXT: brev8 a0, a0
; RV64ZBKB-NEXT: srli a0, a0, 32
; RV64ZBKB-NEXT: ret
;
; RV32ZBP-LABEL: test_bitreverse_i32:
; RV32ZBP: # %bb.0:
; RV32ZBP-NEXT: rev a0, a0
; RV32ZBP-NEXT: ret
;
; RV64ZBP-LABEL: test_bitreverse_i32:
; RV64ZBP: # %bb.0:
; RV64ZBP-NEXT: rev.w a0, a0
; RV64ZBP-NEXT: ret
%tmp = call i32 @llvm.bitreverse.i32(i32 %a)
ret i32 %tmp
}
Expand Down Expand Up @@ -740,6 +806,18 @@ define i64 @test_bitreverse_i64(i64 %a) nounwind {
; RV64ZBKB-NEXT: rev8 a0, a0
; RV64ZBKB-NEXT: brev8 a0, a0
; RV64ZBKB-NEXT: ret
;
; RV32ZBP-LABEL: test_bitreverse_i64:
; RV32ZBP: # %bb.0:
; RV32ZBP-NEXT: rev a2, a1
; RV32ZBP-NEXT: rev a1, a0
; RV32ZBP-NEXT: mv a0, a2
; RV32ZBP-NEXT: ret
;
; RV64ZBP-LABEL: test_bitreverse_i64:
; RV64ZBP: # %bb.0:
; RV64ZBP-NEXT: rev a0, a0
; RV64ZBP-NEXT: ret
%tmp = call i64 @llvm.bitreverse.i64(i64 %a)
ret i64 %tmp
}
Expand Down Expand Up @@ -863,6 +941,16 @@ define i16 @test_bswap_bitreverse_i16(i16 %a) nounwind {
; RV64ZBKB-NEXT: brev8 a0, a0
; RV64ZBKB-NEXT: srli a0, a0, 48
; RV64ZBKB-NEXT: ret
;
; RV32ZBP-LABEL: test_bswap_bitreverse_i16:
; RV32ZBP: # %bb.0:
; RV32ZBP-NEXT: rev.b a0, a0
; RV32ZBP-NEXT: ret
;
; RV64ZBP-LABEL: test_bswap_bitreverse_i16:
; RV64ZBP: # %bb.0:
; RV64ZBP-NEXT: rev.b a0, a0
; RV64ZBP-NEXT: ret
%tmp = call i16 @llvm.bswap.i16(i16 %a)
%tmp2 = call i16 @llvm.bitreverse.i16(i16 %tmp)
ret i16 %tmp2
Expand Down Expand Up @@ -983,6 +1071,16 @@ define i32 @test_bswap_bitreverse_i32(i32 %a) nounwind {
; RV64ZBKB-NEXT: brev8 a0, a0
; RV64ZBKB-NEXT: srli a0, a0, 32
; RV64ZBKB-NEXT: ret
;
; RV32ZBP-LABEL: test_bswap_bitreverse_i32:
; RV32ZBP: # %bb.0:
; RV32ZBP-NEXT: rev.b a0, a0
; RV32ZBP-NEXT: ret
;
; RV64ZBP-LABEL: test_bswap_bitreverse_i32:
; RV64ZBP: # %bb.0:
; RV64ZBP-NEXT: rev.b a0, a0
; RV64ZBP-NEXT: ret
%tmp = call i32 @llvm.bswap.i32(i32 %a)
%tmp2 = call i32 @llvm.bitreverse.i32(i32 %tmp)
ret i32 %tmp2
Expand Down Expand Up @@ -1129,6 +1227,17 @@ define i64 @test_bswap_bitreverse_i64(i64 %a) nounwind {
; RV64ZBKB: # %bb.0:
; RV64ZBKB-NEXT: brev8 a0, a0
; RV64ZBKB-NEXT: ret
;
; RV32ZBP-LABEL: test_bswap_bitreverse_i64:
; RV32ZBP: # %bb.0:
; RV32ZBP-NEXT: rev.b a0, a0
; RV32ZBP-NEXT: rev.b a1, a1
; RV32ZBP-NEXT: ret
;
; RV64ZBP-LABEL: test_bswap_bitreverse_i64:
; RV64ZBP: # %bb.0:
; RV64ZBP-NEXT: rev.b a0, a0
; RV64ZBP-NEXT: ret
%tmp = call i64 @llvm.bswap.i64(i64 %a)
%tmp2 = call i64 @llvm.bitreverse.i64(i64 %tmp)
ret i64 %tmp2
Expand Down Expand Up @@ -1253,6 +1362,16 @@ define i16 @test_bitreverse_bswap_i16(i16 %a) nounwind {
; RV64ZBKB-NEXT: brev8 a0, a0
; RV64ZBKB-NEXT: srli a0, a0, 48
; RV64ZBKB-NEXT: ret
;
; RV32ZBP-LABEL: test_bitreverse_bswap_i16:
; RV32ZBP: # %bb.0:
; RV32ZBP-NEXT: rev.b a0, a0
; RV32ZBP-NEXT: ret
;
; RV64ZBP-LABEL: test_bitreverse_bswap_i16:
; RV64ZBP: # %bb.0:
; RV64ZBP-NEXT: rev.b a0, a0
; RV64ZBP-NEXT: ret
%tmp = call i16 @llvm.bitreverse.i16(i16 %a)
%tmp2 = call i16 @llvm.bswap.i16(i16 %tmp)
ret i16 %tmp2
Expand Down Expand Up @@ -1373,6 +1492,16 @@ define i32 @test_bitreverse_bswap_i32(i32 %a) nounwind {
; RV64ZBKB-NEXT: brev8 a0, a0
; RV64ZBKB-NEXT: srli a0, a0, 32
; RV64ZBKB-NEXT: ret
;
; RV32ZBP-LABEL: test_bitreverse_bswap_i32:
; RV32ZBP: # %bb.0:
; RV32ZBP-NEXT: rev.b a0, a0
; RV32ZBP-NEXT: ret
;
; RV64ZBP-LABEL: test_bitreverse_bswap_i32:
; RV64ZBP: # %bb.0:
; RV64ZBP-NEXT: rev.b a0, a0
; RV64ZBP-NEXT: ret
%tmp = call i32 @llvm.bitreverse.i32(i32 %a)
%tmp2 = call i32 @llvm.bswap.i32(i32 %tmp)
ret i32 %tmp2
Expand Down Expand Up @@ -1519,6 +1648,17 @@ define i64 @test_bitreverse_bswap_i64(i64 %a) nounwind {
; RV64ZBKB: # %bb.0:
; RV64ZBKB-NEXT: brev8 a0, a0
; RV64ZBKB-NEXT: ret
;
; RV32ZBP-LABEL: test_bitreverse_bswap_i64:
; RV32ZBP: # %bb.0:
; RV32ZBP-NEXT: rev.b a0, a0
; RV32ZBP-NEXT: rev.b a1, a1
; RV32ZBP-NEXT: ret
;
; RV64ZBP-LABEL: test_bitreverse_bswap_i64:
; RV64ZBP: # %bb.0:
; RV64ZBP-NEXT: rev.b a0, a0
; RV64ZBP-NEXT: ret
%tmp = call i64 @llvm.bitreverse.i64(i64 %a)
%tmp2 = call i64 @llvm.bswap.i64(i64 %tmp)
ret i64 %tmp2
Expand Down

0 comments on commit b55a77d

Please sign in to comment.