Re: Subject: [PATCH] pci/msi: remove redundant calculation in msi_setup_msi_desc

From: Thomas Gleixner
Date: Thu Aug 24 2023 - 05:05:10 EST


On Thu, Aug 24 2023 at 00:27, huangshaobo3@xxxxxxxxxx wrote:
> On Wed, 23 Aug 2023 16:15:27 +0200, Thomas Gleixner wrote:
>> I'm not seeing what this solves:
>
>> > - if (control & PCI_MSI_FLAGS_64BIT)
>> > + if (desc.pci.msi_attrib.is_64)
>
>> Both variants resolve to a test of a bit and a conditional instruction
>> on the result. It's exactly zero difference in terms of "calculation".
>
>> So all this does is change the memory location to test. Not more not
>> less. It does not generate better code and does not save anything.
>
> It may not be appropriate to write to eliminate duplicate calculations,
> can it be proposed again with clean code?

What's wrong with the existing code?