[PATCH] InstCombine: Transform select with and/or cond into select sequence

Matt Arsenault Matthew.Arsenault at amd.com
Wed Feb 4 17:41:14 PST 2015

On 02/03/2015 08:14 PM, Matthias Braun wrote:
> This transforms:
> select((C0 & C1), a, b) -> select(C0, select(C1, a, b), b)
> select((C0 | C1), a, b) -> select(C0, a, select(C1, a, b))
> The result is better on most targets as C0 and C1 do not need to be
> materialized into an integer register but can stay flags.

I think this should be controllable by a target hook depending on the 
type. On R600, where a 64-bit select needs to be split into 2 
instructions, this would be beneficial for 32-bit selects but not 64-bit 
(unless the select can be proven uniform in which case the second form 
is better for two reasons, but that's a much bigger problem to solve)


More information about the llvm-commits mailing list