[llvm-commits] [PATCH]Implement getHostCPUFeatures for ARM Linux platform

Hao Liu Hao.Liu at arm.com
Tue Dec 11 17:39:59 PST 2012


Is it OK to commit this patch?

 

As it’s my first time to do something about LLVM, I need to be more
careful.

 

Thanks,

-Hao

 

From: llvm-commits-bounces at cs.uiuc.edu [mailto:llvm-commits-bounces at cs.uiuc.
edu] On Behalf Of Hao Liu
Sent: 2012年12月11日 10:15
To: 'Evan Cheng'
Cc: llvm-commits at cs.uiuc.edu
Subject: Re: [llvm-commits] [PATCH]Implement getHostCPUFeatures for ARM
Linux platform

 

Hi,

 

Attached is the new reformatted patch.

 

I need to descript why this patch for getHostCPUFeatures is needed and why
can’t detect all the features:

1)       A function getHostCPUName already exists in Host.cpp, it can detect
CPU name. The getHostCPUFeatures is also defined in Host.cpp but it is
default to do nothing.

2)       It can’t detect all the features, as /proc/cpuinfo only defines 19
features, which can be found in arch/arm/kernel/setup.c of source code of
Linux kernel. LLVM defines it own features for ARM in ARM.td. The features
in Linux and features in ARM have differect names, so I map the former to
the latter names.

3)       Not all the 19 features in Linux have the corresponding features in
LLVM, actually these features we don’t care about or have no use. So I only
translate 7 features having corresponding features in LLVM.  As for v6,v7
and thumb2, they are not defined in /pro/cpuinfo, but we can know that
information  from CPU name. But some features are optional for a CPU, such
as NEON and VFP, it can’t get that information from CPU name, so
getHostCPUFeatures is needed.

 

 

Thanks

-Hao

 

From: Evan Cheng [mailto:evan.cheng at apple.com] 
Sent: 2012年12月11日 3:02
To: Hao Liu
Cc: llvm-commits at cs.uiuc.edu
Subject: Re: [llvm-commits] [PATCH]Implement getHostCPUFeatures for ARM
Linux platform

 

Nitpick:

+  if (Implementer == "0x41"){ // ARM Ltd.

 

Please add a space after ')'.

 

This is a welcome fix. We need auto-detection since some benchmarking
efforts do not specify target cpus. However, I can't help but noticing all
the features this patch doesn't detect. Is it possible to detect whether the
cpu supports v6, v7, thumb2, etc.? Or better yet, is it possible to detect
CPU name?

 

Evan

 

On Dec 9, 2012, at 6:44 PM, Hao Liu <Hao.Liu at arm.com> wrote:

 

Hi,

 

Attached is a patch to define getHostCPUFeatures for ARM Linux platform in
Host.cpp. Currently the CPU features have default values. The
getHostCPUFeatures function do nothing and only return false.

 

The implementation is like getHostCPUName for ARM Linux platform in
Host.cpp:

1)       Read /proc/cpuinfo and get the ‘Features’ line.

2)       For each feature which has corresponding feature in LLVM, translate
the feature name in /proc/cpuinfo to LLVM feature key name in ARM.td .

3)       Add all features to StringMap and set value to true.

4)       If success, return true, otherwise return false.

 

 

Thanks,

-Hao

<ARMLinuxFeatures.patch>_______________________________________________
llvm-commits mailing list
 <mailto:llvm-commits at cs.uiuc.edu> llvm-commits at cs.uiuc.edu
 <http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits>
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121212/20a0a910/attachment.html>


More information about the llvm-commits mailing list