labrinea added a comment.

In D94098#2868751 <https://reviews.llvm.org/D94098#2868751>, @efriedma wrote:

> The part I'm confused about is that you're forcing it to use "*r".  At the IR 
> level, LLVM handles something like `call void asm sideeffect "#$0", "r"([8 x 
> i64] %c)` fine.  You'll have to do a bit of work to teach clang to emit that, 
> but it shouldn't be that hard.  I think you can deal with it on the isel end 
> with some relatively small changes to D94097 
> <https://reviews.llvm.org/D94097>.

If you discard my patch and look at the codegen for `__asm__ volatile ("st64b 
%0,[%1]" : : "r" (*input), "r" (addr) : "memory" );`, which uses the struct foo 
as an input operand, you'll see that clang is already passing it by reference. 
All I am doing is making this behavior consistent for output operands too. 
Whether llvm can deal with indirect asm register operands or not is a separate 
story (see llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:8740). I think 
that making clang emit what you sugggested (to pass [8 x i64] by value) is 
inevitably going to be inelegant in a similar way that the previous revision of 
this patch was. Moreover, taking this route entails introducing more inelegant 
changes in D94097 <https://reviews.llvm.org/D94097> (workarounds for MVT::i64x8 
in getCopyToParts() of the same file I previously mentioned). I have been 
unsuccessfully trying all the above and I can continue my efforts for a little 
more, but in my honest opinion I don't see the benefit.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94098/new/

https://reviews.llvm.org/D94098

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to