Files
clang-p2996/llvm/test/CodeGen/Mips/GlobalISel/instruction-select/bswap.mir
Petar Avramovic 94a24e7a40 [MIPS GlobalISel] Select bswap
G_BSWAP is generated from llvm.bswap.<type> intrinsics, clang genrates
these intrinsics from __builtin_bswap32 and __builtin_bswap64.
Add lower and narrowscalar for G_BSWAP.
Lower G_BSWAP on MIPS32, select G_BSWAP on MIPS32 revision 2 and later.

Differential Revision: https://reviews.llvm.org/D71362
2019-12-30 11:13:22 +01:00

31 lines
871 B
YAML

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=mipsel-linux-gnu -run-pass=instruction-select -mattr=+mips32r2 -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=MIPS32R2
--- |
define void @bswap_i32() { entry: ret void }
...
---
name: bswap_i32
alignment: 4
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.1.entry:
liveins: $a0
; MIPS32R2-LABEL: name: bswap_i32
; MIPS32R2: liveins: $a0
; MIPS32R2: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
; MIPS32R2: [[WSBH:%[0-9]+]]:gpr32 = WSBH [[COPY]]
; MIPS32R2: [[ROTR:%[0-9]+]]:gpr32 = ROTR [[WSBH]], 16
; MIPS32R2: $v0 = COPY [[ROTR]]
; MIPS32R2: RetRA implicit $v0
%0:gprb(s32) = COPY $a0
%1:gprb(s32) = G_BSWAP %0
$v0 = COPY %1(s32)
RetRA implicit $v0
...