| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py |
| ; RUN: llc -mtriple=riscv32 -mattr=+experimental-p,+m,+zbb \ |
| ; RUN: -verify-machineinstrs < %s | \ |
| ; RUN: FileCheck %s --check-prefixes=CHECK,RV32 |
| ; RUN: llc -mtriple=riscv64 -mattr=+experimental-p,+m,+zbb \ |
| ; RUN: -verify-machineinstrs < %s | \ |
| ; RUN: FileCheck %s --check-prefixes=CHECK,RV64 |
| |
| define <4 x i8> @test_prev_v4i8(<4 x i8> %a) { |
| ; RV32-LABEL: test_prev_v4i8: |
| ; RV32: # %bb.0: |
| ; RV32-NEXT: rev8 a0, a0 |
| ; RV32-NEXT: ret |
| ; |
| ; RV64-LABEL: test_prev_v4i8: |
| ; RV64: # %bb.0: |
| ; RV64-NEXT: rev8 a0, a0 |
| ; RV64-NEXT: srli a0, a0, 32 |
| ; RV64-NEXT: ret |
| %r = shufflevector <4 x i8> %a, <4 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0> |
| ret <4 x i8> %r |
| } |
| |
| define <2 x i16> @test_prev_v2i16(<2 x i16> %a) { |
| ; RV32-LABEL: test_prev_v2i16: |
| ; RV32: # %bb.0: |
| ; RV32-NEXT: ppairoe.h a0, a0, a0 |
| ; RV32-NEXT: ret |
| ; |
| ; RV64-LABEL: test_prev_v2i16: |
| ; RV64: # %bb.0: |
| ; RV64-NEXT: ppairoe.h a0, a0, a0 |
| ; RV64-NEXT: ret |
| %r = shufflevector <2 x i16> %a, <2 x i16> poison, <2 x i32> <i32 1, i32 0> |
| ret <2 x i16> %r |
| } |
| |
| define <8 x i8> @test_prev_v8i8(<8 x i8> %a) { |
| ; RV32-LABEL: test_prev_v8i8: |
| ; RV32: # %bb.0: |
| ; RV32-NEXT: rev8 a2, a0 |
| ; RV32-NEXT: rev8 a0, a1 |
| ; RV32-NEXT: mv a1, a2 |
| ; RV32-NEXT: ret |
| ; |
| ; RV64-LABEL: test_prev_v8i8: |
| ; RV64: # %bb.0: |
| ; RV64-NEXT: rev8 a0, a0 |
| ; RV64-NEXT: ret |
| %r = shufflevector <8 x i8> %a, <8 x i8> poison, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0> |
| ret <8 x i8> %r |
| } |
| |
| define <4 x i16> @test_prev_v4i16(<4 x i16> %a) { |
| ; RV32-LABEL: test_prev_v4i16: |
| ; RV32: # %bb.0: |
| ; RV32-NEXT: ppairoe.h a2, a0, a0 |
| ; RV32-NEXT: ppairoe.h a0, a1, a1 |
| ; RV32-NEXT: mv a1, a2 |
| ; RV32-NEXT: ret |
| ; |
| ; RV64-LABEL: test_prev_v4i16: |
| ; RV64: # %bb.0: |
| ; RV64-NEXT: rev16 a0, a0 |
| ; RV64-NEXT: ret |
| %r = shufflevector <4 x i16> %a, <4 x i16> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0> |
| ret <4 x i16> %r |
| } |
| |
| define <2 x i32> @test_prev_v2i32(<2 x i32> %a) { |
| ; RV32-LABEL: test_prev_v2i32: |
| ; RV32: # %bb.0: |
| ; RV32-NEXT: mv a2, a0 |
| ; RV32-NEXT: mv a0, a1 |
| ; RV32-NEXT: mv a1, a2 |
| ; RV32-NEXT: ret |
| ; |
| ; RV64-LABEL: test_prev_v2i32: |
| ; RV64: # %bb.0: |
| ; RV64-NEXT: ppairoe.w a0, a0, a0 |
| ; RV64-NEXT: ret |
| %r = shufflevector <2 x i32> %a, <2 x i32> poison, <2 x i32> <i32 1, i32 0> |
| ret <2 x i32> %r |
| } |
| ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: |
| ; CHECK: {{.*}} |