Issue 172965
Summary Mips: expandDivRem can be improved
Labels new issue
Assignees
Reporter qethu
    ```
define i32 @inline_asm_div() {
entry:
 %0 = tail call i32 asm sideeffect "div $0, $1, $2", "=r,r,r,~{hi},~{lo},~{$1}"(i32 2, i32 1)
  ret i32 %0
}
```
llc --mtriple=mipsel-linux-gnu k.ll
```

```
inline_asm_div: # @inline_asm_div
        .cfi_startproc
        .frame  $sp,0,$ra
 .mask   0x00000000,0
        .fmask  0x00000000,0
        .set noreorder
        .set    nomacro
        .set    noat
# %bb.0: # %entry
        addiu   $2, $zero, 2
        addiu $3, $zero, 1
        #APP
        .set    push
        .set    at
 .set    macro
        .set    reorder

        bnez    $3, $tmp0
 div     $zero, $2, $3
        break   7
$tmp0:
        addiu   $1, $zero, -1          ##### ????? why here?
        bne     $3, $1, $tmp1
        lui $1, 32768
        bne     $2, $1, $tmp1
        nop
        break 6
$tmp1:
        mflo    $2

        .set    pop
        #NO_APP
 jr      $ra
        nop
        .set    at
        .set    macro
 .set    reorder
        .end    inline_asm_div
$func_end0:
```


_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to