Add more Pats which generates BHZ32/BHSZ32/BLSZ32/BLZ32.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
It is hard to add tests for
def : Pat<(brcond (i32 (setge GPR:$rs1, (i32 1))), bb:$imm16), (BHZ32 GPR:$rs1, bb:$imm16)>;
Since the original IR pattern
%icmp = icmp sge i32 %x, 1 br i1 %icmp, label %label1, label %label2
is always transformed to an equivalent form by DAGCombiner
%icmp = icmp slt i32 %x, 1 br i1 %icmp, label %label2, label %label1
before reaching to the CSKY backend.
And BHSZ32 has the same issue.
I add these two Pats for BHSZ32 and BHZ32, just in case there is future changes in the DAGCombiner.
Comment Actions
I think the title can be more words. And the description should not be empty. Normally those two parts would be commit msg. @benshi001
Comment Actions
Try something like:
extern void on_false(void); void test_ge_1(int x) { if (!(x >= 1)) on_false(); }
Comment Actions
Unfortunately your program can not lead to BHSZ or BHZ, still BLSZ as follow,
.type test_ge_1,@function test_ge_1: # @test_ge_1 # %bb.0: subi16 sp, sp, 4 st32.w lr, (sp, 0) # 4-byte Folded Spill blsz32 a0, .LBB0_2 # %bb.1: ld32.w lr, (sp, 0) # 4-byte Folded Reload addi16 sp, sp, 4 rts16 .LBB0_2: jsri32 [.LCPI0_0] ld32.w lr, (sp, 0) # 4-byte Folded Reload addi16 sp, sp, 4 rts16 .p2align 1 # %bb.3: .p2align 2, 0x0 .LCPI0_0: .long on_false .Lfunc_end0: .size test_ge_1, .Lfunc_end0-test_ge_1 # -- End function
This comment was removed by benshi001.
Comment Actions
It does test the pattern though. You can see BHZ32 if you pass -stop-after=finalize-isel.
Comment Actions
I still can not get BHZ32/BHSZ32, could you please make another patch for that?
Sorry, I'm not familiar with architecture. I was just passing by.