[PATCH] D101696: [Matrix] Implement C-style explicit type conversions in CXX for matrix types

Florian Hahn via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun May 2 06:23:14 PDT 2021


fhahn added inline comments.


================
Comment at: clang/test/CodeGenCXX/matrix-casts.cpp:26
+  // CHECK:       [[C:%.*]] = load <25 x i8>, <25 x i8>* {{.*}}, align 1
+  // CHECK-NEXT:  [[CONV:%.*]] = sext <25 x i8> [[C]] to <25 x i32>
+  // CHECK-NEXT:  [[CONV1:%.*]] = bitcast [25 x i32]* {{.*}} to <25 x i32>*
----------------
SaurabhJha wrote:
> fhahn wrote:
> > Shouldn't this use `zext` for the conversion? Possibly that's an issue with the existing conversion code for matrixes?
> Would definitely debug it but would like to quickly clarify this.
> 
> [[ https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/CGExprScalar.cpp#L1225-L1236 | This ]] is the code that's being executed. For int->int conversion, we are just checking the whether input is signed and regardless of whether output type is signed, we do `CreateIntCast`. We probably need to check `OutputSigned` too, right?
Nevermind, the scalar version I checked used `zext` due to some AArch64 specific optimization! So `sext` should be fine here. But that still leaves the int->float case. https://clang.godbolt.org/z/a5Tjed7sP


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101696



More information about the cfe-commits mailing list