[PATCH] D59035: [X86] Promote i8 CMOV's (PR40965)
Andrea Di Biagio via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 15 07:20:12 PDT 2019
andreadb added a comment.
> why can't we simply widen the hands of select, like
>
> define i16 @new(i1 %c) {
>
> %ret = select i1 %c, i16 117, i16 -19
> ret i16 %ret
>
> }
>
> https://rise4fun.com/Alive/cs8
> ?
I never said that we cannot fix it in a different way. I just wanted to point out a poor codegen issue, and show one possible way to fix it (if you had to do it manually).
If by widening the select operands we fix the issue then great.
To answer to the question:
"Why do you think we'd need to flip the CMOV condition?"
I don't *think* that it is needed if you use a different mapping for registers.
The reason why your solution doesn't require to flip the CMOV condition is only because regalloc swapped the mappings for the moves.
With your approach you get:
movl $117, %ecx
movl $65517, %eax # imm = 0xFFED
In my case, I didn't touch register mappings:
movl $117, %eax
movl $-19, %ecx
Since the result has to be moved to EAX, in your case you can simply write
cmov
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59035/new/
https://reviews.llvm.org/D59035
More information about the llvm-commits
mailing list