On 23/09/19 11:54, David Hildenbrand wrote:
> On 23.09.19 11:51, Paolo Bonzini wrote:
>> On 22/09/19 05:54, Richard Henderson wrote:
>>> +/* Wrap the unaligned load helpers to that they have a common signature.  
>>> */
>>> +static inline uint64_t wrap_ldub(const void *haddr)
>>> +{
>>> +    return ldub_p(haddr);
>>> +}
>>> +
>>> +static inline uint64_t wrap_lduw_be(const void *haddr)
>>> +{
>>> +    return lduw_be_p(haddr);
>>> +}
>>> +
>>> +static inline uint64_t wrap_lduw_le(const void *haddr)
>>> +{
>>> +    return lduw_le_p(haddr);
>>> +}
>>> +
>>> +static inline uint64_t wrap_ldul_be(const void *haddr)
>>> +{
>>> +    return (uint32_t)ldl_be_p(haddr);
>>> +}
>>> +
>>> +static inline uint64_t wrap_ldul_le(const void *haddr)
>>> +{
>>> +    return (uint32_t)ldl_le_p(haddr);
>>> +}
>>
>> Any reason to have these five functions (plus five for stores) instead
>> of a pair
>>
>> static uint64_t ld_memop(const void *haddr, MemOp op)
>> {
>> }
>>
>> static uint64_t st_memop(void *haddr, MemOp op, uint64_t val)
>> {
>> }
>>
>> that includes the switches?  Everything should be inlined just the same
>> if you do
>>
>>         if (unlikely(tlb_addr & TLB_BSWAP)) {
>>             st_memop(haddr, op ^ MO_BSWAP, val);
>>         } else {
>>             st_memop(haddr, op, val);
>>         }
> 
> I asked the same question on v2 and Richard explained that - for
> whatever reason -  the compiler will not properly propagate the constant
> in the "op ^ MO_BSWAP" case.

Even if ld_memop and st_memop are __always_inline__?

Paolo

Reply via email to