[llvm-dev] [RFC] bitfield access shrinking

Krzysztof Parzyszek via llvm-dev llvm-dev at lists.llvm.org
Thu Mar 9 10:57:15 PST 2017


On 3/9/2017 12:47 PM, Hal Finkel wrote:
>
> On 03/09/2017 12:28 PM, Krzysztof Parzyszek via llvm-dev wrote:
>> We could add intrinsics to extract/insert a bitfield, which would
>> simplify a lot of that bitwise logic.
>
> But then you need to teach a bunch of places about how to simply them,
> fold using bitwise logic and other things that reduce demanded bits into
> them, etc. This seems like a difficult tradeoff.

Bitfield extraction/insertion generally does not simplify well with 
surrounding arithmetic. The main generator of the bitwise manipulation 
is SROA and if it was the only creator of these intrinsics, it would 
already make things simpler. We'd also need to teach the combiner about 
them, but that's still fairly localized.
On the other hand, they would make the intent of the code explicit. 
Targets could handle them any way they want, whether it's loading an 
i128, or an i16 from an adjusted offset.

-Krzysztof

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation


More information about the llvm-dev mailing list