[PATCH] D52961: [RISCV] Introduce the RISCVMatInt::generateInstSeq helper

Sameer AbuAsal via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 10 15:30:07 PDT 2018


sabuasal added a comment.

In https://reviews.llvm.org/D52961#1258464, @asb wrote:

> In https://reviews.llvm.org/D52961#1258446, @sabuasal wrote:
>
> > The helper makes it clear to follow. Thanks!
> >
> > I am just not sure why you did the change to prefer add to addiw when for 64bit?  is addi faster than addiw?
>
>
> No real reason to prefer one or the other when they're semantically identical. It's mostly to be closer to gas/gcc which uses addi at least for the isInt<12> case.


I see. makes sense.

> $echo "li x11, -2048" | llvm-mc -filetype=obj -triple=riscv64  -o  ./a.out && riscv64-unknown-linux-gnu-objdump  -dr -M no-aliases ./a.out
> 
> ./a.out:     file format elf64-littleriscv
> 
> Disassembly of section .text:
> 
> 0000000000000000 <.text>:
> 
>   0:   8000059b                addiw   a1,zero,-2048
> 
> $echo "li x11, -2048" | riscv64-unknown-linux-gnu-as -o  ./a.out && riscv64-unknown-linux-gnu-objdump  -dr -M no-aliases ./a.out
> 
> ./a.out:     file format elf64-littleriscv
> 
> Disassembly of section .text:
> 
> 0000000000000000 <.text>:
> 
>   0:   80000593                addi    a1,zero,-2048




https://reviews.llvm.org/D52961





More information about the llvm-commits mailing list