[PATCH] D153751: [CSKY] Optimize ANDI/ORI to BSETI/BCLRI for specific immediates
Ben Shi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 26 03:29:01 PDT 2023
benshi001 added inline comments.
================
Comment at: llvm/test/CodeGen/CSKY/bseti_bclri.ll:25
; CHECK: # %bb.0:
; CHECK-NEXT: ori32 a0, a0, 192
; CHECK-NEXT: rts16
----------------
This is not optimized to two BSETI due to the immediate can be encoded to ORI32.
================
Comment at: llvm/test/CodeGen/CSKY/bseti_bclri.ll:34
; CHECK: # %bb.0:
; CHECK-NEXT: ori32 a0, a0, 3072
; CHECK-NEXT: rts16
----------------
This is not optimized to two `BSETI` due to the immediate can be encoded to `ORI32`.
================
Comment at: llvm/test/CodeGen/CSKY/bseti_bclri.ll:43
; CHECK: # %bb.0:
; CHECK-NEXT: movih32 a1, 3
; CHECK-NEXT: or16 a0, a1
----------------
This is not optimized to two `BSETI`s due to the immediate can be composed via a single `MOVIH32`.
================
Comment at: llvm/test/CodeGen/CSKY/bseti_bclri.ll:68
+; CHECK-NEXT: addu16 a0, a1
+; CHECK-NEXT: rts16
+ %3 = or i32 %0, 65540
----------------
This is not optimized to two BSETIs due to the immediate is used twice.
================
Comment at: llvm/test/CodeGen/CSKY/bseti_bclri.ll:96
; CHECK: # %bb.0:
; CHECK-NEXT: andni32 a0, a0, 192
; CHECK-NEXT: rts16
----------------
This is not optimized to two `BCLRI` due to the immediate can be encoded into `ANDNI`.
================
Comment at: llvm/test/CodeGen/CSKY/bseti_bclri.ll:103
define i32 @test_andnot_3072(i32 noundef %0) {
; CHECK-LABEL: test_andnot_3072:
; CHECK: # %bb.0:
----------------
This is not optimized to two `BCLRI` due to the immediate can be encoded into `ANDNI`.
================
Comment at: llvm/test/CodeGen/CSKY/bseti_bclri.ll:134
+; CHECK-LABEL: test_andnot_65540_twice:
+; CHECK: # %bb.0:
+; CHECK-NEXT: movih32 a2, 65534
----------------
This is not optimized to two `BCLRI32` due to the immediate is used twice.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153751/new/
https://reviews.llvm.org/D153751
More information about the llvm-commits
mailing list