[llvm] [RISCV] Expand mul X, C where C=2^N*(3, 5, 9)*(3, 5, 9) (PR #108100)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 10 17:54:00 PDT 2024


https://github.com/dtcxzyw requested changes to this pull request.

Miscompilation:
```
; bin/llc -mtriple=riscv64 -mattr=+m,+zba test.ll -o -
define i64 @mul108(i64 %x) nounwind {
  %mul = mul i64 %x, 108
  ret i64 %mul
}

define i64 @mul135(i64 %x) nounwind {
  %mul = mul i64 %x, 135
  ret i64 %mul
}
```
```
        .text
        .attribute      4, 16
        .attribute      5, "rv64i2p1_m2p0_zmmul1p0_zba1p0"
        .file   "test.ll"
        .globl  mul108                          # -- Begin function mul108
        .p2align        2
        .type   mul108, at function
mul108:                                 # @mul108
# %bb.0:
        sh3add  a0, a0, a0
        sh1add  a0, a0, a0
        ret
.Lfunc_end0:
        .size   mul108, .Lfunc_end0-mul108
                                        # -- End function
        .globl  mul135                          # -- Begin function mul135
        .p2align        2
        .type   mul135, at function
mul135:                                 # @mul135
# %bb.0:
        sh3add  a0, a0, a0
        sh1add  a0, a0, a0
        ret
.Lfunc_end1:
        .size   mul135, .Lfunc_end1-mul135
                                        # -- End function
        .section        ".note.GNU-stack","", at progbits
```


https://github.com/llvm/llvm-project/pull/108100


More information about the llvm-commits mailing list