1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00
llvm-mirror/lib/Target/AArch64/select-bswap.mir
Jessica Paquette bc25529f39 [GlobalISel][AArch64] Select llvm.bswap* for non-vector types
This teaches the IRTranslator to emit G_BSWAP when it runs into
Intrinsic::bswap. This allows us to select G_BSWAP for non-vector types in
AArch64.

Add a select-bswap.mir test, and add global isel checks to a couple existing
tests in test/CodeGen/AArch64.

This doesn't handle every bswap case, since some of these rely on known bits
stuff. This just lets us handle the naive case.

Differential Revision: https://reviews.llvm.org/D58081

llvm-svn: 353861
2019-02-12 17:28:17 +00:00

39 lines
975 B
YAML

# RUN: llc -verify-machineinstrs -mtriple aarch64--- \
# RUN: -run-pass=instruction-select -mattr=+fullfp16 -global-isel %s -o - \
# RUN: | FileCheck %s
...
---
name: bswap_s32
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0:
; CHECK-LABEL: name: bswap_s32
; CHECK: [[COPY:%[0-9]+]]:gpr32 = COPY $w0
; CHECK: [[REVWr:%[0-9]+]]:gpr32 = REVWr [[COPY]]
; CHECK: $w0 = COPY [[REVWr]]
liveins: $s0
%0:gpr(s32) = COPY $w0
%1:gpr(s32) = G_BSWAP %0
$w0 = COPY %1(s32)
...
---
name: bswap_s64
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0:
; CHECK-LABEL: name: bswap_s64
; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
; CHECK: [[REVXr:%[0-9]+]]:gpr64 = REVXr [[COPY]]
; CHECK: $x0 = COPY [[REVXr]]
liveins: $x0
%0:gpr(s64) = COPY $d0
%1:gpr(s64) = G_BSWAP %0
$x0 = COPY %1(s64)
...