r181750 - Use atomic instructions on linux thumb v7.
Renato Golin
renato.golin at linaro.org
Tue May 14 03:27:48 PDT 2013
Hi Bill,
This is a correction of the first patch. Also, please consider merging to
3.3.
Thanks,
--renato
On 14 May 2013 01:44, Rafael Espindola <rafael.espindola at gmail.com> wrote:
> Author: rafael
> Date: Mon May 13 19:44:24 2013
> New Revision: 181750
>
> URL: http://llvm.org/viewvc/llvm-project?rev=181750&view=rev
> Log:
> Use atomic instructions on linux thumb v7.
>
> This matches gcc's behaviour. The patch also explicitly parses the version
> so
> that this keeps working when we add support for v8.
>
> Modified:
> cfe/trunk/lib/Basic/Targets.cpp
> cfe/trunk/test/CodeGen/linux-arm-atomic.c
>
> Modified: cfe/trunk/lib/Basic/Targets.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=181750&r1=181749&r2=181750&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Basic/Targets.cpp (original)
> +++ cfe/trunk/lib/Basic/Targets.cpp Mon May 13 19:44:24 2013
> @@ -3536,9 +3536,23 @@ class ARMTargetInfo : public TargetInfo
> if (T.getOS() != llvm::Triple::Linux)
> return false;
> StringRef ArchName = T.getArchName();
> - if (ArchName.startswith("armv6") || ArchName.startswith("armv7"))
> - return true;
> - return false;
> + if (T.getArch() == llvm::Triple::arm) {
> + if (!ArchName.startswith("armv"))
> + return false;
> + StringRef VersionStr = ArchName.substr(4);
> + unsigned Version;
> + if (VersionStr.getAsInteger(10, Version))
> + return false;
> + return Version >= 6;
> + }
> + assert(T.getArch() == llvm::Triple::thumb);
> + if (!ArchName.startswith("thumbv"))
> + return false;
> + StringRef VersionStr = ArchName.substr(6);
> + unsigned Version;
> + if (VersionStr.getAsInteger(10, Version))
> + return false;
> + return Version >= 7;
> }
>
> public:
>
> Modified: cfe/trunk/test/CodeGen/linux-arm-atomic.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/linux-arm-atomic.c?rev=181750&r1=181749&r2=181750&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/CodeGen/linux-arm-atomic.c (original)
> +++ cfe/trunk/test/CodeGen/linux-arm-atomic.c Mon May 13 19:44:24 2013
> @@ -1,5 +1,6 @@
> // RUN: %clang_cc1 %s -emit-llvm -o - -triple=armv7-unknown-linux |
> FileCheck %s
> // RUN: %clang_cc1 %s -emit-llvm -o - -triple=armv6-unknown-linux |
> FileCheck %s
> +// RUN: %clang_cc1 %s -emit-llvm -o - -triple=thumbv7-unknown-linux |
> FileCheck %s
>
> typedef int _Atomic_word;
> _Atomic_word exchange_and_add(volatile _Atomic_word *__mem, int __val) {
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130514/9ac7066f/attachment.html>
More information about the cfe-commits
mailing list