Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -5429,7 +5429,10 @@ CmdArgs.push_back("-femulated-tls"); // AltiVec-like language extensions aren't relevant for assembling. if (!isa(JA) || Output.getType() != types::TY_PP_Asm) { - Args.AddLastArg(CmdArgs, options::OPT_faltivec); + if (Args.hasFlag(options::OPT_faltivec, + options::OPT_fno_altivec, /*Default=*/false)) + Args.AddLastArg(CmdArgs, options::OPT_faltivec); + Args.AddLastArg(CmdArgs, options::OPT_fzvector); } Args.AddLastArg(CmdArgs, options::OPT_fdiagnostics_show_template_tree); Index: test/Driver/ppc-features.cpp =================================================================== --- test/Driver/ppc-features.cpp +++ test/Driver/ppc-features.cpp @@ -63,51 +63,67 @@ // RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-1 %s // CHECK-1: "-target-feature" "-altivec" +// CHECK-1-NOT: "-faltivec" // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-2 %s // CHECK-2: "-target-feature" "-altivec" +// CHECK-2-NOT: "-faltivec" // RUN: %clang -target powerpc64-unknown-linux-gnu %s -faltivec -mno-altivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-3 %s // CHECK-3: "-target-feature" "-altivec" +// CHECK-3-NOT: "-faltivec" // RUN: %clang -target powerpc64-unknown-linux-gnu %s -maltivec -fno-altivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-4 %s // CHECK-4: "-target-feature" "-altivec" +// CHECK-4-NOT: "-faltivec" // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -faltivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-5 %s -// CHECK-5-NOT: "-target-feature" "-altivec" +// CHECK-5: "-target-feature" "+altivec" +// CHECK-5: "-faltivec" // RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -maltivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-6 %s -// CHECK-6-NOT: "-target-feature" "-altivec" +// CHECK-6: "-target-feature" "+altivec" +// CHECK-6: "-faltivec" // RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=7400 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-7 %s // CHECK-7: "-target-feature" "-altivec" +// CHECK-7-NOT: "-faltivec" // RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=g4 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-8 %s // CHECK-8: "-target-feature" "-altivec" +// CHECK-8-NOT: "-faltivec" // RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=7450 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-9 %s // CHECK-9: "-target-feature" "-altivec" +// CHECK-9-NOT: "-faltivec" // RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=g4+ -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-10 %s // CHECK-10: "-target-feature" "-altivec" +// CHECK-10-NOT: "-faltivec" // RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=970 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-11 %s // CHECK-11: "-target-feature" "-altivec" +// CHECK-11-NOT: "-faltivec" // RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=g5 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-12 %s // CHECK-12: "-target-feature" "-altivec" +// CHECK-12-NOT: "-faltivec" // RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=pwr6 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-13 %s // CHECK-13: "-target-feature" "-altivec" +// CHECK-13-NOT: "-faltivec" // RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=pwr7 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-14 %s // CHECK-14: "-target-feature" "-altivec" +// CHECK-14-NOT: "-faltivec" // RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=pwr8 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-15 %s // CHECK-15: "-target-feature" "-altivec" +// CHECK-15-NOT: "-faltivec" // RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=ppc64 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-16 %s // CHECK-16: "-target-feature" "-altivec" +// CHECK-16-NOT: "-faltivec" // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-qpx -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOQPX %s // CHECK-NOQPX: "-target-feature" "-qpx"