Skip to content

Commit

Permalink
Add PowerPC little endian support and remove TARGET_CPU_* defines
Browse files Browse the repository at this point in the history
The PowerPC version of read_time() is not being selected on
little endian because we are only catching the big endian cases:

 #if (TARGET_CPU_powerpc == 1 || TARGET_CPU_powerpc64 == 1)

This is the only place we use TARGET_CPU_*, and it is simpler (and
more common) to use standard c pre-processor defines:

 #if defined(__powerpc__) || defined(__powerpc64__)

This works on gcc, llvm/clang and IBM xlc. With this change we can
remove TARGET_CPU_* completely.
  • Loading branch information
antonblanchard committed Nov 20, 2015
1 parent a9ecee2 commit 29f6951
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 15 deletions.
6 changes: 0 additions & 6 deletions runtime/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,7 @@ libcsmith_la_SOURCES = \
GIT_HASH := $(shell "$(top_srcdir)/git-hash.sh" "$(top_srcdir)" || echo error)
GIT_FLAG = -DGIT_VERSION=\"$(GIT_HASH)\"

## ENE: The idea of stuffing the target CPU name (a string) into a CPP symbol
## is kind of awful. What we should do instead is use the name to modify the
## include path, e.g., -I"$(target_cpu)". But that refactoring is for a later
## day...

libcsmith_a_CPPFLAGS = \
-DTARGET_CPU_$(target_cpu)=1 \
$(GIT_FLAG)
libcsmith_la_CPPFLAGS = \
$(libcsmith_a_CPPFLAGS)
Expand Down
1 change: 0 additions & 1 deletion runtime/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@ libcsmith_la_SOURCES = \
GIT_HASH := $(shell "$(top_srcdir)/git-hash.sh" "$(top_srcdir)" || echo error)
GIT_FLAG = -DGIT_VERSION=\"$(GIT_HASH)\"
libcsmith_a_CPPFLAGS = \
-DTARGET_CPU_$(target_cpu)=1 \
$(GIT_FLAG)

libcsmith_la_CPPFLAGS = \
Expand Down
6 changes: 0 additions & 6 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,7 @@ EXTRA_DIST = \
GIT_HASH := $(shell "$(top_srcdir)/git-hash.sh" "$(top_srcdir)" || echo error)
GIT_FLAG = -DGIT_VERSION=\"$(GIT_HASH)\"

## ENE: The idea of stuffing the target CPU name (a string) into a CPP symbol
## is kind of awful. What we should do instead is use the name to modify the
## include path, e.g., -I"$(target_cpu)". But that refactoring is for a later
## day...

csmith_CPPFLAGS = \
-DTARGET_CPU_$(target_cpu)=1 \
$(GIT_FLAG) \
$(BOOST_CPPFLAGS)

Expand Down
1 change: 0 additions & 1 deletion src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,6 @@ EXTRA_DIST = \
GIT_HASH := $(shell "$(top_srcdir)/git-hash.sh" "$(top_srcdir)" || echo error)
GIT_FLAG = -DGIT_VERSION=\"$(GIT_HASH)\"
csmith_CPPFLAGS = \
-DTARGET_CPU_$(target_cpu)=1 \
$(GIT_FLAG) \
$(BOOST_CPPFLAGS)

Expand Down
2 changes: 1 addition & 1 deletion src/platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

#include "platform.h"

#if (TARGET_CPU_powerpc == 1 || TARGET_CPU_powerpc64 == 1)
#if defined(__powerpc__) || defined(__powerpc64__)
static inline unsigned long read_time(void)
{
unsigned long a;
Expand Down

0 comments on commit 29f6951

Please sign in to comment.