r371805 - For PR17164: split -fno-lax-vector-conversion into three different

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 12 19:20:01 PDT 2019


Author: rsmith
Date: Thu Sep 12 19:20:00 2019
New Revision: 371805

URL: http://llvm.org/viewvc/llvm-project?rev=371805&view=rev
Log:
For PR17164: split -fno-lax-vector-conversion into three different
levels:

 -- none: no lax vector conversions [new GCC default]
 -- integer: only conversions between integer vectors [old GCC default]
 -- all: all conversions between same-size vectors [Clang default]

For now, Clang still defaults to "all" mode, but per my proposal on
cfe-dev (2019-04-10) the default will be changed to "integer" as soon as
that doesn't break lots of testcases. (Eventually I'd like to change the
default to "none" to match GCC and general sanity.)

Following GCC's behavior, the driver flag -flax-vector-conversions is
translated to -flax-vector-conversions=integer.

Modified:
    cfe/trunk/include/clang/Basic/LangOptions.def
    cfe/trunk/include/clang/Basic/LangOptions.h
    cfe/trunk/include/clang/Driver/Options.td
    cfe/trunk/lib/Driver/ToolChains/Clang.cpp
    cfe/trunk/lib/Frontend/CompilerInvocation.cpp
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/test/CodeGen/builtins-systemz-vector.c
    cfe/trunk/test/CodeGen/builtins-systemz-vector2.c
    cfe/trunk/test/CodeGen/builtins-systemz-vector3.c
    cfe/trunk/test/CodeGen/builtins-systemz-zvector-error.c
    cfe/trunk/test/CodeGen/builtins-systemz-zvector.c
    cfe/trunk/test/CodeGen/builtins-systemz-zvector2-error.c
    cfe/trunk/test/CodeGen/builtins-systemz-zvector2.c
    cfe/trunk/test/CodeGen/builtins-systemz-zvector3-error.c
    cfe/trunk/test/CodeGen/builtins-systemz-zvector3.c
    cfe/trunk/test/CodeGen/builtins-wasm.c
    cfe/trunk/test/CodeGenCXX/builtins-systemz-zvector.cpp
    cfe/trunk/test/Headers/altivec-header.c
    cfe/trunk/test/Headers/arm-neon-header.c
    cfe/trunk/test/Headers/x86-intrinsics-headers-clean.cpp
    cfe/trunk/test/Headers/x86-intrinsics-headers.c
    cfe/trunk/test/Headers/x86intrin-2.c
    cfe/trunk/test/Headers/x86intrin.c
    cfe/trunk/test/Sema/ext_vector_casts.c
    cfe/trunk/test/Sema/typedef-retain.c
    cfe/trunk/test/Sema/zvector.c
    cfe/trunk/test/Sema/zvector2.c
    cfe/trunk/test/SemaCXX/altivec.cpp
    cfe/trunk/test/SemaCXX/vector-no-lax.cpp
    cfe/trunk/test/SemaCXX/vector.cpp

Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Thu Sep 12 19:20:00 2019
@@ -119,7 +119,8 @@ LANGOPT(AppleKext         , 1, 0, "Apple
 BENIGN_LANGOPT(PascalStrings, 1, 0, "Pascal string support")
 LANGOPT(WritableStrings   , 1, 0, "writable string support")
 LANGOPT(ConstStrings      , 1, 0, "const-qualified string support")
-LANGOPT(LaxVectorConversions , 1, 1, "lax vector conversions")
+ENUM_LANGOPT(LaxVectorConversions, LaxVectorConversionKind, 2,
+             LaxVectorConversionKind::All, "lax vector conversions")
 LANGOPT(AltiVec           , 1, 0, "AltiVec-style vector initializers")
 LANGOPT(ZVector           , 1, 0, "System z vector extensions")
 LANGOPT(Exceptions        , 1, 0, "exception handling")

Modified: cfe/trunk/include/clang/Basic/LangOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.h?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/LangOptions.h (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.h Thu Sep 12 19:20:00 2019
@@ -184,6 +184,16 @@ public:
     FEA_On
   };
 
+  enum class LaxVectorConversionKind {
+    /// Permit no implicit vector bitcasts.
+    None,
+    /// Permit vector bitcasts between integer vectors with different numbers
+    /// of elements but the same total bit-width.
+    Integer,
+    /// Permit vector bitcasts between all vectors with the same total
+    /// bit-width.
+    All,
+  };
 
 public:
   /// Set of enabled sanitizers.

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Thu Sep 12 19:20:00 2019
@@ -1274,7 +1274,10 @@ def fno_fine_grained_bitfield_accesses :
   HelpText<"Use large-integer access for consecutive bitfield runs.">;
 
 def flat__namespace : Flag<["-"], "flat_namespace">;
-def flax_vector_conversions : Flag<["-"], "flax-vector-conversions">, Group<f_Group>;
+def flax_vector_conversions_EQ : Joined<["-"], "flax-vector-conversions=">, Group<f_Group>,
+  HelpText<"Enable implicit vector bit-casts">, Values<"none,integer,all">, Flags<[CC1Option]>;
+def flax_vector_conversions : Flag<["-"], "flax-vector-conversions">, Group<f_Group>,
+  Alias<flax_vector_conversions_EQ>, AliasArgs<["integer"]>;
 def flimited_precision_EQ : Joined<["-"], "flimited-precision=">, Group<f_Group>;
 def fapple_link_rtlib : Flag<["-"], "fapple-link-rtlib">, Group<f_Group>,
   HelpText<"Force linking the clang builtins runtime library">;
@@ -1448,7 +1451,7 @@ def fno_experimental_new_pass_manager :
 def fveclib : Joined<["-"], "fveclib=">, Group<f_Group>, Flags<[CC1Option]>,
     HelpText<"Use the given vector functions library">, Values<"Accelerate,MASSV,SVML,none">;
 def fno_lax_vector_conversions : Flag<["-"], "fno-lax-vector-conversions">, Group<f_Group>,
-  HelpText<"Disallow implicit conversions between vectors with a different number of elements or different element types">, Flags<[CC1Option]>;
+  Alias<flax_vector_conversions_EQ>, AliasArgs<["none"]>;
 def fno_merge_all_constants : Flag<["-"], "fno-merge-all-constants">, Group<f_Group>,
   HelpText<"Disallow merging of constants">;
 def fno_modules : Flag <["-"], "fno-modules">, Group<f_Group>,

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Thu Sep 12 19:20:00 2019
@@ -4678,15 +4678,11 @@ void Clang::ConstructJob(Compilation &C,
   if (TC.SupportsProfiling())
     Args.AddLastArg(CmdArgs, options::OPT_mfentry);
 
-  // -flax-vector-conversions is default.
-  if (!Args.hasFlag(options::OPT_flax_vector_conversions,
-                    options::OPT_fno_lax_vector_conversions))
-    CmdArgs.push_back("-fno-lax-vector-conversions");
-
   if (Args.getLastArg(options::OPT_fapple_kext) ||
       (Args.hasArg(options::OPT_mkernel) && types::isCXX(InputType)))
     CmdArgs.push_back("-fapple-kext");
 
+  Args.AddLastArg(CmdArgs, options::OPT_flax_vector_conversions_EQ);
   Args.AddLastArg(CmdArgs, options::OPT_fobjc_sender_dependent_dispatch);
   Args.AddLastArg(CmdArgs, options::OPT_fdiagnostics_print_source_range_info);
   Args.AddLastArg(CmdArgs, options::OPT_fdiagnostics_parseable_fixits);

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu Sep 12 19:20:00 2019
@@ -2265,7 +2265,7 @@ void CompilerInvocation::setLangDefaults
   if (Opts.OpenCL) {
     Opts.AltiVec = 0;
     Opts.ZVector = 0;
-    Opts.LaxVectorConversions = 0;
+    Opts.setLaxVectorConversions(LangOptions::LaxVectorConversionKind::None);
     Opts.setDefaultFPContractMode(LangOptions::FPC_On);
     Opts.NativeHalfType = 1;
     Opts.NativeHalfArgsAndReturns = 1;
@@ -2667,8 +2667,18 @@ static void ParseLangArgs(LangOptions &O
   Opts.WritableStrings = Args.hasArg(OPT_fwritable_strings);
   Opts.ConstStrings = Args.hasFlag(OPT_fconst_strings, OPT_fno_const_strings,
                                    Opts.ConstStrings);
-  if (Args.hasArg(OPT_fno_lax_vector_conversions))
-    Opts.LaxVectorConversions = 0;
+  if (Arg *A = Args.getLastArg(OPT_flax_vector_conversions_EQ)) {
+    using LaxKind = LangOptions::LaxVectorConversionKind;
+    if (auto Kind = llvm::StringSwitch<Optional<LaxKind>>(A->getValue())
+                        .Case("none", LaxKind::None)
+                        .Case("integer", LaxKind::Integer)
+                        .Case("all", LaxKind::All)
+                        .Default(llvm::None))
+      Opts.setLaxVectorConversions(*Kind);
+    else
+      Diags.Report(diag::err_drv_invalid_value)
+          << A->getAsString(Args) << A->getValue();
+  }
   if (Args.hasArg(OPT_fno_threadsafe_statics))
     Opts.ThreadsafeStatics = 0;
   Opts.Exceptions = Args.hasArg(OPT_fexceptions);

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Sep 12 19:20:00 2019
@@ -6498,8 +6498,28 @@ bool Sema::areLaxCompatibleVectorTypes(Q
 bool Sema::isLaxVectorConversion(QualType srcTy, QualType destTy) {
   assert(destTy->isVectorType() || srcTy->isVectorType());
 
-  if (!Context.getLangOpts().LaxVectorConversions)
+  switch (Context.getLangOpts().getLaxVectorConversions()) {
+  case LangOptions::LaxVectorConversionKind::None:
     return false;
+
+  case LangOptions::LaxVectorConversionKind::Integer:
+    if (!srcTy->isIntegralOrEnumerationType()) {
+      auto *Vec = srcTy->getAs<VectorType>();
+      if (!Vec || !Vec->getElementType()->isIntegralOrEnumerationType())
+        return false;
+    }
+    if (!destTy->isIntegralOrEnumerationType()) {
+      auto *Vec = destTy->getAs<VectorType>();
+      if (!Vec || !Vec->getElementType()->isIntegralOrEnumerationType())
+        return false;
+    }
+    // OK, integer (vector) -> integer (vector) bitcast.
+    break;
+
+    case LangOptions::LaxVectorConversionKind::All:
+    break;
+  }
+
   return areLaxCompatibleVectorTypes(srcTy, destTy);
 }
 

Modified: cfe/trunk/test/CodeGen/builtins-systemz-vector.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-systemz-vector.c?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtins-systemz-vector.c (original)
+++ cfe/trunk/test/CodeGen/builtins-systemz-vector.c Thu Sep 12 19:20:00 2019
@@ -1,5 +1,5 @@
 // REQUIRES: systemz-registered-target
-// RUN: %clang_cc1 -target-cpu z13 -triple s390x-ibm-linux -fno-lax-vector-conversions \
+// RUN: %clang_cc1 -target-cpu z13 -triple s390x-ibm-linux -flax-vector-conversions=none \
 // RUN: -Wall -Wno-unused -Werror -emit-llvm %s -o - | FileCheck %s
 
 typedef __attribute__((vector_size(16))) signed char vec_schar;

Modified: cfe/trunk/test/CodeGen/builtins-systemz-vector2.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-systemz-vector2.c?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtins-systemz-vector2.c (original)
+++ cfe/trunk/test/CodeGen/builtins-systemz-vector2.c Thu Sep 12 19:20:00 2019
@@ -1,5 +1,5 @@
 // REQUIRES: systemz-registered-target
-// RUN: %clang_cc1 -target-cpu z14 -triple s390x-ibm-linux -fno-lax-vector-conversions \
+// RUN: %clang_cc1 -target-cpu z14 -triple s390x-ibm-linux -flax-vector-conversions=none \
 // RUN: -Wall -Wno-unused -Werror -emit-llvm %s -o - | FileCheck %s
 
 typedef __attribute__((vector_size(16))) signed char vec_schar;

Modified: cfe/trunk/test/CodeGen/builtins-systemz-vector3.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-systemz-vector3.c?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtins-systemz-vector3.c (original)
+++ cfe/trunk/test/CodeGen/builtins-systemz-vector3.c Thu Sep 12 19:20:00 2019
@@ -1,5 +1,5 @@
 // REQUIRES: systemz-registered-target
-// RUN: %clang_cc1 -target-cpu arch13 -triple s390x-ibm-linux -fno-lax-vector-conversions \
+// RUN: %clang_cc1 -target-cpu arch13 -triple s390x-ibm-linux -flax-vector-conversions=none \
 // RUN: -Wall -Wno-unused -Werror -emit-llvm %s -o - | FileCheck %s
 
 typedef __attribute__((vector_size(16))) signed char vec_schar;

Modified: cfe/trunk/test/CodeGen/builtins-systemz-zvector-error.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-systemz-zvector-error.c?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtins-systemz-zvector-error.c (original)
+++ cfe/trunk/test/CodeGen/builtins-systemz-zvector-error.c Thu Sep 12 19:20:00 2019
@@ -1,6 +1,6 @@
 // REQUIRES: systemz-registered-target
 // RUN: %clang_cc1 -target-cpu z13 -triple s390x-linux-gnu \
-// RUN: -fzvector -fno-lax-vector-conversions \
+// RUN: -fzvector -flax-vector-conversions=none \
 // RUN: -Wall -Wno-unused -Werror -fsyntax-only -verify %s
 
 #include <vecintrin.h>

Modified: cfe/trunk/test/CodeGen/builtins-systemz-zvector.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-systemz-zvector.c?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtins-systemz-zvector.c (original)
+++ cfe/trunk/test/CodeGen/builtins-systemz-zvector.c Thu Sep 12 19:20:00 2019
@@ -1,9 +1,9 @@
 // REQUIRES: systemz-registered-target
 // RUN: %clang_cc1 -target-cpu z13 -triple s390x-linux-gnu \
-// RUN: -O -fzvector -fno-lax-vector-conversions \
+// RUN: -O -fzvector -flax-vector-conversions=none \
 // RUN: -Wall -Wno-unused -Werror -emit-llvm %s -o - | FileCheck %s
 // RUN: %clang_cc1 -target-cpu z13 -triple s390x-linux-gnu \
-// RUN: -O -fzvector -fno-lax-vector-conversions \
+// RUN: -O -fzvector -flax-vector-conversions=none \
 // RUN: -Wall -Wno-unused -Werror -S %s -o - | FileCheck %s --check-prefix=CHECK-ASM
 
 #include <vecintrin.h>

Modified: cfe/trunk/test/CodeGen/builtins-systemz-zvector2-error.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-systemz-zvector2-error.c?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtins-systemz-zvector2-error.c (original)
+++ cfe/trunk/test/CodeGen/builtins-systemz-zvector2-error.c Thu Sep 12 19:20:00 2019
@@ -1,6 +1,6 @@
 // REQUIRES: systemz-registered-target
 // RUN: %clang_cc1 -target-cpu z14 -triple s390x-linux-gnu \
-// RUN: -fzvector -fno-lax-vector-conversions \
+// RUN: -fzvector -flax-vector-conversions=none \
 // RUN: -Wall -Wno-unused -Werror -fsyntax-only -verify %s
 
 #include <vecintrin.h>

Modified: cfe/trunk/test/CodeGen/builtins-systemz-zvector2.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-systemz-zvector2.c?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtins-systemz-zvector2.c (original)
+++ cfe/trunk/test/CodeGen/builtins-systemz-zvector2.c Thu Sep 12 19:20:00 2019
@@ -1,9 +1,9 @@
 // REQUIRES: systemz-registered-target
 // RUN: %clang_cc1 -target-cpu z14 -triple s390x-linux-gnu \
-// RUN: -O -fzvector -fno-lax-vector-conversions \
+// RUN: -O -fzvector -flax-vector-conversions=none \
 // RUN: -Wall -Wno-unused -Werror -emit-llvm %s -o - | FileCheck %s
 // RUN: %clang_cc1 -target-cpu z14 -triple s390x-linux-gnu \
-// RUN: -O -fzvector -fno-lax-vector-conversions \
+// RUN: -O -fzvector -flax-vector-conversions=none \
 // RUN: -Wall -Wno-unused -Werror -S %s -o - | FileCheck %s --check-prefix=CHECK-ASM
 
 #include <vecintrin.h>

Modified: cfe/trunk/test/CodeGen/builtins-systemz-zvector3-error.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-systemz-zvector3-error.c?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtins-systemz-zvector3-error.c (original)
+++ cfe/trunk/test/CodeGen/builtins-systemz-zvector3-error.c Thu Sep 12 19:20:00 2019
@@ -1,6 +1,6 @@
 // REQUIRES: systemz-registered-target
 // RUN: %clang_cc1 -target-cpu arch13 -triple s390x-linux-gnu \
-// RUN: -fzvector -fno-lax-vector-conversions \
+// RUN: -fzvector -flax-vector-conversions=none \
 // RUN: -Wall -Wno-unused -Werror -fsyntax-only -verify %s
 
 #include <vecintrin.h>

Modified: cfe/trunk/test/CodeGen/builtins-systemz-zvector3.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-systemz-zvector3.c?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtins-systemz-zvector3.c (original)
+++ cfe/trunk/test/CodeGen/builtins-systemz-zvector3.c Thu Sep 12 19:20:00 2019
@@ -1,9 +1,9 @@
 // REQUIRES: systemz-registered-target
 // RUN: %clang_cc1 -target-cpu arch13 -triple s390x-linux-gnu \
-// RUN: -O -fzvector -fno-lax-vector-conversions \
+// RUN: -O -fzvector -flax-vector-conversions=none \
 // RUN: -Wall -Wno-unused -Werror -emit-llvm %s -o - | FileCheck %s
 // RUN: %clang_cc1 -target-cpu arch13 -triple s390x-linux-gnu \
-// RUN: -O -fzvector -fno-lax-vector-conversions \
+// RUN: -O -fzvector -flax-vector-conversions=none \
 // RUN: -Wall -Wno-unused -Werror -S %s -o - | FileCheck %s --check-prefix=CHECK-ASM
 
 #include <vecintrin.h>

Modified: cfe/trunk/test/CodeGen/builtins-wasm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-wasm.c?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtins-wasm.c (original)
+++ cfe/trunk/test/CodeGen/builtins-wasm.c Thu Sep 12 19:20:00 2019
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -triple wasm32-unknown-unknown -target-feature +unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature +exception-handling -target-feature +bulk-memory -fno-lax-vector-conversions -O3 -emit-llvm -o - %s | FileCheck %s -check-prefixes WEBASSEMBLY,WEBASSEMBLY32
-// RUN: %clang_cc1 -triple wasm64-unknown-unknown -target-feature +unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature +exception-handling -target-feature +bulk-memory -fno-lax-vector-conversions -O3 -emit-llvm -o - %s | FileCheck %s -check-prefixes WEBASSEMBLY,WEBASSEMBLY64
-// RUN: not %clang_cc1 -triple wasm64-unknown-unknown -target-feature +nontrapping-fptoint -target-feature +exception-handling -target-feature +bulk-memory -fno-lax-vector-conversions -O3 -emit-llvm -o - %s 2>&1 | FileCheck %s -check-prefixes MISSING-SIMD
+// RUN: %clang_cc1 -triple wasm32-unknown-unknown -target-feature +unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature +exception-handling -target-feature +bulk-memory -flax-vector-conversions=none -O3 -emit-llvm -o - %s | FileCheck %s -check-prefixes WEBASSEMBLY,WEBASSEMBLY32
+// RUN: %clang_cc1 -triple wasm64-unknown-unknown -target-feature +unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature +exception-handling -target-feature +bulk-memory -flax-vector-conversions=none -O3 -emit-llvm -o - %s | FileCheck %s -check-prefixes WEBASSEMBLY,WEBASSEMBLY64
+// RUN: not %clang_cc1 -triple wasm64-unknown-unknown -target-feature +nontrapping-fptoint -target-feature +exception-handling -target-feature +bulk-memory -flax-vector-conversions=none -O3 -emit-llvm -o - %s 2>&1 | FileCheck %s -check-prefixes MISSING-SIMD
 
 // SIMD convenience types
 typedef char i8x16 __attribute((vector_size(16)));

Modified: cfe/trunk/test/CodeGenCXX/builtins-systemz-zvector.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/builtins-systemz-zvector.cpp?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/builtins-systemz-zvector.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/builtins-systemz-zvector.cpp Thu Sep 12 19:20:00 2019
@@ -1,6 +1,6 @@
 // REQUIRES: systemz-registered-target
 // RUN: %clang_cc1 -target-cpu z13 -triple s390x-linux-gnu \
-// RUN: -fzvector -fno-lax-vector-conversions -std=c++11 \
+// RUN: -fzvector -flax-vector-conversions=none -std=c++11 \
 // RUN: -Wall -Wno-unused -Werror -emit-llvm %s -o - | FileCheck %s
 
 bool gb;

Modified: cfe/trunk/test/Headers/altivec-header.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/altivec-header.c?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/test/Headers/altivec-header.c (original)
+++ cfe/trunk/test/Headers/altivec-header.c Thu Sep 12 19:20:00 2019
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -triple powerpc64-unknown-unknown -target-feature +altivec -ffreestanding -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -target-feature +altivec -ffreestanding -emit-llvm -fno-lax-vector-conversions -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -target-feature +altivec -ffreestanding -emit-llvm -flax-vector-conversions=none -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple powerpc64-unknown-unknown -target-feature +altivec -ffreestanding -emit-llvm -x c++ -o - %s | FileCheck %s
 
 #include <altivec.h>

Modified: cfe/trunk/test/Headers/arm-neon-header.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/arm-neon-header.c?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/test/Headers/arm-neon-header.c (original)
+++ cfe/trunk/test/Headers/arm-neon-header.c Thu Sep 12 19:20:00 2019
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -triple thumbv7-apple-darwin10 -target-cpu cortex-a8 -fsyntax-only -Wvector-conversions -ffreestanding %s
-// RUN: %clang_cc1 -triple thumbv7-apple-darwin10 -target-cpu cortex-a8 -fsyntax-only -fno-lax-vector-conversions -ffreestanding %s
+// RUN: %clang_cc1 -triple thumbv7-apple-darwin10 -target-cpu cortex-a8 -fsyntax-only -flax-vector-conversions=none -ffreestanding %s
 // RUN: %clang_cc1 -x c++ -triple thumbv7-apple-darwin10 -target-cpu cortex-a8 -fsyntax-only -Wvector-conversions -ffreestanding %s
 
 // RUN: %clang -fsyntax-only               -ffreestanding --target=aarch64-none-eabi -march=armv8.2-a+fp16 -std=c89 -xc %s

Modified: cfe/trunk/test/Headers/x86-intrinsics-headers-clean.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/x86-intrinsics-headers-clean.cpp?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/test/Headers/x86-intrinsics-headers-clean.cpp (original)
+++ cfe/trunk/test/Headers/x86-intrinsics-headers-clean.cpp Thu Sep 12 19:20:00 2019
@@ -1,7 +1,7 @@
 // Make sure the intrinsic headers compile cleanly with no warnings or errors.
 
 // RUN: %clang_cc1 -ffreestanding -triple x86_64-unknown-unknown -Wsystem-headers \
-// RUN:   -fsyntax-only -fno-lax-vector-conversions -x c++ -verify %s
+// RUN:   -fsyntax-only -flax-vector-conversions=none -x c++ -verify %s
 
 // expected-no-diagnostics
 

Modified: cfe/trunk/test/Headers/x86-intrinsics-headers.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/x86-intrinsics-headers.c?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/test/Headers/x86-intrinsics-headers.c (original)
+++ cfe/trunk/test/Headers/x86-intrinsics-headers.c Thu Sep 12 19:20:00 2019
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -fsyntax-only -ffreestanding %s
-// RUN: %clang_cc1 -fsyntax-only -ffreestanding -fno-lax-vector-conversions %s
+// RUN: %clang_cc1 -fsyntax-only -ffreestanding -flax-vector-conversions=none %s
 // RUN: %clang_cc1 -fsyntax-only -ffreestanding -x c++ %s
 
 #if defined(i386) || defined(__x86_64__)

Modified: cfe/trunk/test/Headers/x86intrin-2.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/x86intrin-2.c?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/test/Headers/x86intrin-2.c (original)
+++ cfe/trunk/test/Headers/x86intrin-2.c Thu Sep 12 19:20:00 2019
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -fsyntax-only -ffreestanding %s -verify
-// RUN: %clang_cc1 -fsyntax-only -ffreestanding -fno-lax-vector-conversions %s -verify
+// RUN: %clang_cc1 -fsyntax-only -ffreestanding -flax-vector-conversions=none %s -verify
 // RUN: %clang_cc1 -fsyntax-only -ffreestanding -x c++ %s -verify
 // expected-no-diagnostics
 

Modified: cfe/trunk/test/Headers/x86intrin.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/x86intrin.c?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/test/Headers/x86intrin.c (original)
+++ cfe/trunk/test/Headers/x86intrin.c Thu Sep 12 19:20:00 2019
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -fsyntax-only -ffreestanding %s -verify
-// RUN: %clang_cc1 -fsyntax-only -ffreestanding -fno-lax-vector-conversions %s -verify
+// RUN: %clang_cc1 -fsyntax-only -ffreestanding -flax-vector-conversions=none %s -verify
 // RUN: %clang_cc1 -fsyntax-only -ffreestanding -x c++ %s -verify
 // expected-no-diagnostics
 

Modified: cfe/trunk/test/Sema/ext_vector_casts.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/ext_vector_casts.c?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/test/Sema/ext_vector_casts.c (original)
+++ cfe/trunk/test/Sema/ext_vector_casts.c Thu Sep 12 19:20:00 2019
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -fsyntax-only -verify -fno-lax-vector-conversions -Wconversion %s
+// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -fsyntax-only -verify -flax-vector-conversions=none -Wconversion %s
 
 typedef __attribute__((ext_vector_type(8))) _Bool BoolVector; // expected-error {{invalid vector element type '_Bool'}}
 

Modified: cfe/trunk/test/Sema/typedef-retain.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/typedef-retain.c?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/test/Sema/typedef-retain.c (original)
+++ cfe/trunk/test/Sema/typedef-retain.c Thu Sep 12 19:20:00 2019
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -fno-lax-vector-conversions
+// RUN: %clang_cc1 -fsyntax-only -verify %s -flax-vector-conversions=none
 
 typedef float float4 __attribute__((vector_size(16)));
 typedef int int4 __attribute__((vector_size(16)));

Modified: cfe/trunk/test/Sema/zvector.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/zvector.c?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/test/Sema/zvector.c (original)
+++ cfe/trunk/test/Sema/zvector.c Thu Sep 12 19:20:00 2019
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -triple s390x-linux-gnu -fzvector \
-// RUN:  -fno-lax-vector-conversions -W -Wall -Wconversion \
+// RUN:  -flax-vector-conversions=none -W -Wall -Wconversion \
 // RUN:  -Werror -fsyntax-only -verify %s
 
 vector signed char sc, sc2;

Modified: cfe/trunk/test/Sema/zvector2.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/zvector2.c?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/test/Sema/zvector2.c (original)
+++ cfe/trunk/test/Sema/zvector2.c Thu Sep 12 19:20:00 2019
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -triple s390x-linux-gnu -fzvector -target-cpu z14 \
-// RUN:  -fno-lax-vector-conversions -W -Wall -Wconversion \
+// RUN:  -flax-vector-conversions=none -W -Wall -Wconversion \
 // RUN:  -Werror -fsyntax-only -verify %s
 
 vector signed char sc, sc2;

Modified: cfe/trunk/test/SemaCXX/altivec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/altivec.cpp?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/altivec.cpp (original)
+++ cfe/trunk/test/SemaCXX/altivec.cpp Thu Sep 12 19:20:00 2019
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -target-feature +altivec -fno-lax-vector-conversions -triple powerpc-unknown-unknown -fcxx-exceptions -verify %s
+// RUN: %clang_cc1 -target-feature +altivec -flax-vector-conversions=none -triple powerpc-unknown-unknown -fcxx-exceptions -verify %s
 
 typedef int V4i __attribute__((vector_size(16)));
 

Modified: cfe/trunk/test/SemaCXX/vector-no-lax.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/vector-no-lax.cpp?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/vector-no-lax.cpp (original)
+++ cfe/trunk/test/SemaCXX/vector-no-lax.cpp Thu Sep 12 19:20:00 2019
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fno-lax-vector-conversions -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -flax-vector-conversions=none -verify %s
 typedef unsigned int __attribute__((vector_size (16))) vUInt32;
 typedef int __attribute__((vector_size (16))) vSInt32;
 

Modified: cfe/trunk/test/SemaCXX/vector.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/vector.cpp?rev=371805&r1=371804&r2=371805&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/vector.cpp (original)
+++ cfe/trunk/test/SemaCXX/vector.cpp Thu Sep 12 19:20:00 2019
@@ -1,6 +1,8 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify %s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=c++98 %s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=c++11 %s
+// RUN: %clang_cc1 -flax-vector-conversions=all -triple x86_64-apple-darwin10 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -flax-vector-conversions=all -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -flax-vector-conversions=all -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=c++11 %s
+// RUN: %clang_cc1 -flax-vector-conversions=integer -triple x86_64-apple-darwin10 -fsyntax-only -verify %s -DNO_LAX_FLOAT
+// RUN: %clang_cc1 -flax-vector-conversions=none -triple x86_64-apple-darwin10 -fsyntax-only -verify %s -DNO_LAX_FLOAT -DNO_LAX_INT
 
 typedef char char16 __attribute__ ((__vector_size__ (16)));
 typedef long long longlong16 __attribute__ ((__vector_size__ (16)));
@@ -8,13 +10,19 @@ typedef char char16_e __attribute__ ((__
 typedef long long longlong16_e __attribute__ ((__ext_vector_type__ (2)));
 
 // Test overloading and function calls with vector types.
-void f0(char16);
+void f0(char16); // expected-note 0+{{candidate}}
 
 void f0_test(char16 c16, longlong16 ll16, char16_e c16e, longlong16_e ll16e) {
   f0(c16);
   f0(ll16);
+#ifdef NO_LAX_INT
+  // expected-error at -2 {{no matching function}}
+#endif
   f0(c16e);
   f0(ll16e);
+#ifdef NO_LAX_INT
+  // expected-error at -2 {{no matching function}}
+#endif
 }
 
 int &f1(char16);
@@ -27,12 +35,14 @@ void f1_test(char16 c16, longlong16 ll16
   float &fr2 = f1(ll16e);
 }
 
-void f2(char16_e); // expected-note{{no known conversion from 'longlong16_e' (vector of 2 'long long' values) to 'char16_e' (vector of 16 'char' values) for 1st argument}} \
-       // expected-note{{candidate function not viable: no known conversion from 'convertible_to<longlong16_e>' to 'char16_e' (vector of 16 'char' values) for 1st argument}}
+void f2(char16_e); // expected-note 0+{{candidate}}
 
 void f2_test(char16 c16, longlong16 ll16, char16_e c16e, longlong16_e ll16e) {
   f2(c16);
   f2(ll16);
+#ifdef NO_LAX_INT
+  // expected-error at -2 {{no matching function}}
+#endif
   f2(c16e);
   f2(ll16e); // expected-error{{no matching function}}
   f2('a');
@@ -58,6 +68,11 @@ void conditional(bool Cond, char16 c16,
   (void)(Cond? c16 : ll16);
   (void)(Cond? ll16e : c16e);
   (void)(Cond? ll16e : c16);
+#ifdef NO_LAX_INT
+  // expected-error at -4 {{cannot convert}}
+  // expected-error at -4 {{cannot convert}}
+  // expected-error at -4 {{cannot convert}}
+#endif
 }
 
 // Test C++ cast'ing of vector types.
@@ -85,9 +100,16 @@ void casts(longlong16 ll16, longlong16_e
   // static_cast
   (void)static_cast<char16>(ll16);
   (void)static_cast<char16_e>(ll16);
+#ifdef NO_LAX_INT
+  // expected-error at -3 {{not allowed}}
+  // expected-error at -3 {{not allowed}}
+#endif
   (void)static_cast<longlong16>(ll16);
   (void)static_cast<longlong16_e>(ll16);
   (void)static_cast<char16>(ll16e);
+#ifdef NO_LAX_INT
+  // expected-error at -2 {{not allowed}}
+#endif
   (void)static_cast<char16_e>(ll16e); // expected-error{{static_cast from 'longlong16_e' (vector of 2 'long long' values) to 'char16_e' (vector of 16 'char' values) is not allowed}}
   (void)static_cast<longlong16>(ll16e);
   (void)static_cast<longlong16_e>(ll16e);
@@ -121,10 +143,19 @@ void test_implicit_conversions(bool Cond
                                convertible_to<char16_e&> rto_c16e) {
   f0(to_c16);
   f0(to_ll16);
+#ifdef NO_LAX_INT
+  // expected-error at -2 {{no matching function}}
+#endif
   f0(to_c16e);
   f0(to_ll16e);
+#ifdef NO_LAX_INT
+  // expected-error at -2 {{no matching function}}
+#endif
   f2(to_c16);
   f2(to_ll16);
+#ifdef NO_LAX_INT
+  // expected-error at -2 {{no matching function}}
+#endif
   f2(to_c16e);
   f2(to_ll16e); // expected-error{{no matching function}}
 
@@ -193,6 +224,10 @@ void test_implicit_conversions(bool Cond
   // These 2 are convertible with -flax-vector-conversions (default)
   (void)(Cond? to_c16 : to_ll16);
   (void)(Cond? to_c16e : to_ll16e);
+#ifdef NO_LAX_INT
+  // expected-error at -3 {{cannot convert}}
+  // expected-error at -3 {{cannot convert}}
+#endif
 }
 
 typedef float fltx2 __attribute__((__vector_size__(8)));
@@ -203,6 +238,10 @@ typedef double dblx4 __attribute__((__ve
 void accept_fltx2(fltx2); // expected-note{{candidate function not viable: no known conversion from 'double' to 'fltx2' (vector of 2 'float' values) for 1st argument}}
 void accept_fltx4(fltx4);
 void accept_dblx2(dblx2);
+#ifdef NO_LAX_FLOAT
+// expected-note at -3 {{no known conversion}}
+// expected-note at -3 {{no known conversion}}
+#endif
 void accept_dblx4(dblx4);
 void accept_bool(bool); // expected-note{{candidate function not viable: no known conversion from 'fltx2' (vector of 2 'float' values) to 'bool' for 1st argument}}
 
@@ -214,9 +253,12 @@ void test(fltx2 fltx2_val, fltx4 fltx4_v
   accept_dblx4(dblx4_val);
 
   // Same-size conversions
-  // FIXME: G++ rejects these conversions, we accept them. Revisit this!
   accept_fltx4(dblx2_val);
   accept_dblx2(fltx4_val);
+#ifdef NO_LAX_FLOAT
+  // expected-error at -3 {{no matching function}}
+  // expected-error at -3 {{no matching function}}
+#endif
 
   // Conversion to bool.
   accept_bool(fltx2_val); // expected-error{{no matching function for call to 'accept_bool'}}
@@ -227,9 +269,9 @@ void test(fltx2 fltx2_val, fltx4 fltx4_v
 
 typedef int intx4 __attribute__((__vector_size__(16)));
 typedef int inte4 __attribute__((__ext_vector_type__(4)));
-typedef int flte4 __attribute__((__ext_vector_type__(4)));
+typedef float flte4 __attribute__((__ext_vector_type__(4)));
 
-void test_mixed_vector_types(fltx4 f, intx4 n, flte4 g, flte4 m) {
+void test_mixed_vector_types(fltx4 f, intx4 n, flte4 g, inte4 m) {
   (void)(f == g);
   (void)(g != f);
   (void)(f <= g);
@@ -295,40 +337,40 @@ typedef bool bad __attribute__((__vector
 namespace Templates {
 template <typename Elt, unsigned Size>
 struct TemplateVectorType {
-  typedef Elt __attribute__((__vector_size__(Size))) type;
+  typedef Elt __attribute__((__vector_size__(Size))) type; // #1
 };
 
 template <int N, typename T>
 struct PR15730 {
   typedef T __attribute__((vector_size(N * sizeof(T)))) type;
-  typedef T __attribute__((vector_size(8192))) type2;
-  typedef T __attribute__((vector_size(3))) type3;
+  typedef T __attribute__((vector_size(8192))) type2; // #2
+  typedef T __attribute__((vector_size(3))) type3; // #3
 };
 
 void Init() {
   const TemplateVectorType<float, 32>::type Works = {};
   const TemplateVectorType<int, 32>::type Works2 = {};
-  // expected-error at 298 {{invalid vector element type 'bool'}}
+  // expected-error@#1 {{invalid vector element type 'bool'}}
   // expected-note at +1 {{in instantiation of template class 'Templates::TemplateVectorType<bool, 32>' requested here}}
   const TemplateVectorType<bool, 32>::type NoBool;
-  // expected-error at 298 {{invalid vector element type 'int __attribute__((ext_vector_type(4)))' (vector of 4 'int' values)}}
+  // expected-error@#1 {{invalid vector element type 'int __attribute__((ext_vector_type(4)))' (vector of 4 'int' values)}}
   // expected-note at +1 {{in instantiation of template class 'Templates::TemplateVectorType<int __attribute__((ext_vector_type(4))), 32>' requested here}}
   const TemplateVectorType<vi4, 32>::type NoComplex;
-  // expected-error at 298 {{vector size not an integral multiple of component size}}
+  // expected-error@#1 {{vector size not an integral multiple of component size}}
   // expected-note at +1 {{in instantiation of template class 'Templates::TemplateVectorType<int, 33>' requested here}}
   const TemplateVectorType<int, 33>::type BadSize;
-  // expected-error at 298 {{vector size too large}}
+  // expected-error@#1 {{vector size too large}}
   // expected-note at +1 {{in instantiation of template class 'Templates::TemplateVectorType<int, 8192>' requested here}}
   const TemplateVectorType<int, 8192>::type TooLarge;
-  // expected-error at 298 {{zero vector size}}
+  // expected-error@#1 {{zero vector size}}
   // expected-note at +1 {{in instantiation of template class 'Templates::TemplateVectorType<int, 0>' requested here}}
   const TemplateVectorType<int, 0>::type Zero;
 
-  // expected-error at 304 {{vector size too large}}
-  // expected-error at 305 {{vector size not an integral multiple of component size}}
+  // expected-error@#2 {{vector size too large}}
+  // expected-error@#3 {{vector size not an integral multiple of component size}}
   // expected-note at +1 {{in instantiation of template class 'Templates::PR15730<8, int>' requested here}}
   const PR15730<8, int>::type PR15730_1 = {};
-  // expected-error at 304 {{vector size too large}}
+  // expected-error@#2 {{vector size too large}}
   // expected-note at +1 {{in instantiation of template class 'Templates::PR15730<8, char>' requested here}}
   const PR15730<8, char>::type2 PR15730_2 = {};
 }




More information about the cfe-commits mailing list