This revision was automatically updated to reflect the committed changes. Closed by commit rG7cfded350a7e: [PowerPC] Add clang option -m[no-]pcrel (authored by lei).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80757/new/ https://reviews.llvm.org/D80757 Files: clang/include/clang/Driver/Options.td clang/lib/Basic/Targets/PPC.cpp clang/lib/Basic/Targets/PPC.h clang/test/Driver/ppc-pcrel.cpp Index: clang/test/Driver/ppc-pcrel.cpp =================================================================== --- /dev/null +++ clang/test/Driver/ppc-pcrel.cpp @@ -0,0 +1,12 @@ +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -mcpu=pwr10 -mpcrel -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-PCREL %s +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -mcpu=pwr10 -mno-pcrel -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOPCREL %s +// CHECK-NOPCREL: "-target-feature" "-pcrel" +// CHECK-PCREL: "-target-feature" "+pcrel" + +// RUN: %clang -target powerpc64-unknown-linux-gnu -mcpu=pwr10 -emit-llvm -S %s -o - | grep "attributes.*+pcrelative-memops" +// RUN: %clang -target powerpc64-unknown-linux-gnu -mcpu=pwr10 -mpcrel -emit-llvm -S %s -o - | grep "attributes.*+pcrelative-memops" +// RUN: %clang -target powerpc64-unknown-linux-gnu -mcpu=pwr10 -mno-pcrel -emit-llvm -S %s -o - | grep "attributes.*\-pcrelative-memops" + +int main(int argc, char *argv[]) { + return 0; +} Index: clang/lib/Basic/Targets/PPC.h =================================================================== --- clang/lib/Basic/Targets/PPC.h +++ clang/lib/Basic/Targets/PPC.h @@ -69,6 +69,7 @@ bool HasExtDiv = false; bool HasP9Vector = false; bool HasSPE = false; + bool HasPCRelativeMemops = false; protected: std::string ABI; Index: clang/lib/Basic/Targets/PPC.cpp =================================================================== --- clang/lib/Basic/Targets/PPC.cpp +++ clang/lib/Basic/Targets/PPC.cpp @@ -54,6 +54,8 @@ HasFloat128 = true; } else if (Feature == "+power9-vector") { HasP9Vector = true; + } else if (Feature == "+pcrelative-memops") { + HasPCRelativeMemops = true; } else if (Feature == "+spe") { HasSPE = true; LongDoubleWidth = LongDoubleAlign = 64; @@ -346,6 +348,7 @@ void PPCTargetInfo::addP10SpecificFeatures( llvm::StringMap<bool> &Features) const { Features["htm"] = false; // HTM was removed for P10. + Features["pcrelative-memops"] = true; return; } @@ -369,6 +372,7 @@ .Case("extdiv", HasExtDiv) .Case("float128", HasFloat128) .Case("power9-vector", HasP9Vector) + .Case("pcrelative-memops", HasPCRelativeMemops) .Case("spe", HasSPE) .Default(false); } @@ -389,7 +393,10 @@ Features["vsx"] = Features["altivec"] = true; if (Name == "power9-vector") Features["power8-vector"] = true; - Features[Name] = true; + if (Name == "pcrel") + Features["pcrelative-memops"] = true; + else + Features[Name] = true; } else { // If we're disabling altivec or vsx go ahead and disable all of the vsx // features. @@ -398,7 +405,10 @@ Features["float128"] = Features["power9-vector"] = false; if (Name == "power8-vector") Features["power9-vector"] = false; - Features[Name] = false; + if (Name == "pcrel") + Features["pcrelative-memops"] = false; + else + Features[Name] = false; } } Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -2470,6 +2470,8 @@ def fno_altivec : Flag<["-"], "fno-altivec">, Group<f_Group>, Flags<[DriverOption]>; def maltivec : Flag<["-"], "maltivec">, Group<m_ppc_Features_Group>; def mno_altivec : Flag<["-"], "mno-altivec">, Group<m_ppc_Features_Group>; +def mpcrel: Flag<["-"], "mpcrel">, Group<m_ppc_Features_Group>; +def mno_pcrel: Flag<["-"], "mno-pcrel">, Group<m_ppc_Features_Group>; def mspe : Flag<["-"], "mspe">, Group<m_ppc_Features_Group>; def mno_spe : Flag<["-"], "mno-spe">, Group<m_ppc_Features_Group>; def mvsx : Flag<["-"], "mvsx">, Group<m_ppc_Features_Group>;
Index: clang/test/Driver/ppc-pcrel.cpp =================================================================== --- /dev/null +++ clang/test/Driver/ppc-pcrel.cpp @@ -0,0 +1,12 @@ +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -mcpu=pwr10 -mpcrel -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-PCREL %s +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -mcpu=pwr10 -mno-pcrel -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOPCREL %s +// CHECK-NOPCREL: "-target-feature" "-pcrel" +// CHECK-PCREL: "-target-feature" "+pcrel" + +// RUN: %clang -target powerpc64-unknown-linux-gnu -mcpu=pwr10 -emit-llvm -S %s -o - | grep "attributes.*+pcrelative-memops" +// RUN: %clang -target powerpc64-unknown-linux-gnu -mcpu=pwr10 -mpcrel -emit-llvm -S %s -o - | grep "attributes.*+pcrelative-memops" +// RUN: %clang -target powerpc64-unknown-linux-gnu -mcpu=pwr10 -mno-pcrel -emit-llvm -S %s -o - | grep "attributes.*\-pcrelative-memops" + +int main(int argc, char *argv[]) { + return 0; +} Index: clang/lib/Basic/Targets/PPC.h =================================================================== --- clang/lib/Basic/Targets/PPC.h +++ clang/lib/Basic/Targets/PPC.h @@ -69,6 +69,7 @@ bool HasExtDiv = false; bool HasP9Vector = false; bool HasSPE = false; + bool HasPCRelativeMemops = false; protected: std::string ABI; Index: clang/lib/Basic/Targets/PPC.cpp =================================================================== --- clang/lib/Basic/Targets/PPC.cpp +++ clang/lib/Basic/Targets/PPC.cpp @@ -54,6 +54,8 @@ HasFloat128 = true; } else if (Feature == "+power9-vector") { HasP9Vector = true; + } else if (Feature == "+pcrelative-memops") { + HasPCRelativeMemops = true; } else if (Feature == "+spe") { HasSPE = true; LongDoubleWidth = LongDoubleAlign = 64; @@ -346,6 +348,7 @@ void PPCTargetInfo::addP10SpecificFeatures( llvm::StringMap<bool> &Features) const { Features["htm"] = false; // HTM was removed for P10. + Features["pcrelative-memops"] = true; return; } @@ -369,6 +372,7 @@ .Case("extdiv", HasExtDiv) .Case("float128", HasFloat128) .Case("power9-vector", HasP9Vector) + .Case("pcrelative-memops", HasPCRelativeMemops) .Case("spe", HasSPE) .Default(false); } @@ -389,7 +393,10 @@ Features["vsx"] = Features["altivec"] = true; if (Name == "power9-vector") Features["power8-vector"] = true; - Features[Name] = true; + if (Name == "pcrel") + Features["pcrelative-memops"] = true; + else + Features[Name] = true; } else { // If we're disabling altivec or vsx go ahead and disable all of the vsx // features. @@ -398,7 +405,10 @@ Features["float128"] = Features["power9-vector"] = false; if (Name == "power8-vector") Features["power9-vector"] = false; - Features[Name] = false; + if (Name == "pcrel") + Features["pcrelative-memops"] = false; + else + Features[Name] = false; } } Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -2470,6 +2470,8 @@ def fno_altivec : Flag<["-"], "fno-altivec">, Group<f_Group>, Flags<[DriverOption]>; def maltivec : Flag<["-"], "maltivec">, Group<m_ppc_Features_Group>; def mno_altivec : Flag<["-"], "mno-altivec">, Group<m_ppc_Features_Group>; +def mpcrel: Flag<["-"], "mpcrel">, Group<m_ppc_Features_Group>; +def mno_pcrel: Flag<["-"], "mno-pcrel">, Group<m_ppc_Features_Group>; def mspe : Flag<["-"], "mspe">, Group<m_ppc_Features_Group>; def mno_spe : Flag<["-"], "mno-spe">, Group<m_ppc_Features_Group>; def mvsx : Flag<["-"], "mvsx">, Group<m_ppc_Features_Group>;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits