[PATCH] D103615: [Clang] Add option for vector compare compatibility.

Stefan Pintilie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 11 08:58:35 PDT 2021


stefanp added a comment.

In D103615#2799498 <https://reviews.llvm.org/D103615#2799498>, @bmahjour wrote:

> As far as I can see, there is no good reason for the special treatment of vector bool/pixel going forward. Could we drop this special treatment, or at least change the default to use scalar results across the board (consistent with XL's behaviour and clang's current behaviour for most cases).

We can change this but I am hesitant to make the change immediately. I can leave the default behavior as-is for now and add a warning to say that this feature is going to be deprecated at a later date. After a couple of releases we can then change the default. I don't want to change defaults without giving users some kind of warning first.

As a result of this I'm going to change the name in the enum from `Default` to `Mixed` as it does not make sense to have it named Default if it's not going to be default in the long run.



================
Comment at: clang/include/clang/Driver/Options.td:3811
   MarshallingInfoFlag<HeaderSearchOpts<"Verbose">>;
+def vector_abi_compat : Joined<["-"], "vector-abi-compat=">, Flags<[CC1Option]>, Group<f_Group>,
+  HelpText<"Determines whether vector compare returns a vector or a scalar. Options: default, gcc, xl.">,
----------------
bmahjour wrote:
> I'm not sure the term "ABI" is really applicable. Maybe we should call it "vector-compare-compat="
Sure. I can change the name to `vector-compare-compat`.


================
Comment at: clang/test/CodeGen/vector-compat-pixel-bool-ternary.c:6
+// RUN:   -vector-abi-compat=gcc -triple powerpc-unknown-unknown -S -emit-llvm %s -o - 2>&1| FileCheck %s --check-prefix=ERROR
+// RUN: %clang_cc1 -target-feature +altivec -target-feature +vsx \
+// RUN:   -vector-abi-compat=xl -triple powerpc-unknown-unknown -S -emit-llvm %s -o - | FileCheck %s
----------------
bmahjour wrote:
> I only see the clang FE interface being tested. Does this have to be specified through `-Xclang -vector-abi-compat=...` or is there a clang driver option for it as well? I think we should have a clang driver option and have at least one test for it.
This option works when it is passed immediately to clang.
I will add a couple of RUN lines to test this as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103615



More information about the cfe-commits mailing list