Zi Xuan Wu bdd7c53dc5 [CSKY] Add compressed instruction mapping between 32-bit and 16-bit instruction
Add all CompressPat to map instructions between 16-bit and 32-bit with using the CompressInstEmitter infra.
Although it's only used in asm printer, also enable it in asm parser to debug mapping when -enable-csky-asm-compressed-inst is on.

Differential Revision: https://reviews.llvm.org/D115026
2021-12-06 14:04:54 +08:00

34 lines
790 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -verify-machineinstrs -csky-no-aliases -mattr=+e2 < %s -mtriple=csky | FileCheck %s
define i32 @addRR(i32 %x, i32 %y) {
; CHECK-LABEL: addRR:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: addu16 a0, a1
; CHECK-NEXT: rts16
entry:
%add = add nsw i32 %y, %x
ret i32 %add
}
define i32 @addRI(i32 %x) {
; CHECK-LABEL: addRI:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: addi16 a0, 10
; CHECK-NEXT: rts16
entry:
%add = add nsw i32 %x, 10
ret i32 %add
}
define i32 @addRI_X(i32 %x) {
; CHECK-LABEL: addRI_X:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: movi32 a1, 4097
; CHECK-NEXT: addu16 a0, a1
; CHECK-NEXT: rts16
entry:
%add = add nsw i32 %x, 4097
ret i32 %add
}