about summary refs log tree commit diff
path: root/src/test/codegen/stack-alloc-string-slice.cc
diff options
context:
space:
mode:
authorBjörn Steinbrink <bsteinbr@gmail.com>2015-04-27 00:18:02 +0200
committerBjörn Steinbrink <bsteinbr@gmail.com>2015-04-29 14:45:23 +0200
commit36dccec2f39c7e1da7f056ea421ad5256df3fb0b (patch)
tree7a3cf65a4e09ba2c61f5425126e254faa2e1060f /src/test/codegen/stack-alloc-string-slice.cc
parent8f991d1fc27a176254ebfe99ed7e5a339cb9c7e2 (diff)
downloadrust-36dccec2f39c7e1da7f056ea421ad5256df3fb0b.tar.gz
rust-36dccec2f39c7e1da7f056ea421ad5256df3fb0b.zip
Currently, LLVM lowers a cttz8 on x86_64 to these instructions:
```asm
    movzbl      %dil, %eax
    bsfl        %eax, %eax
    movl        $32, %ecx
    cmovnel     %eax, %ecx
    cmpl        $32, %ecx
    movl        $8, %eax
    cmovnel     %ecx, %eax
```

which has some unnecessary overhead, having two conditional moves.

To improve the codegen, we can zero extend the 8 bit integer, then set
bit 8 and perform a cttz operation on the extended value. That way
there's no conditional operation involved at all.
Diffstat (limited to 'src/test/codegen/stack-alloc-string-slice.cc')
0 files changed, 0 insertions, 0 deletions