[llvm-commits] [vector_llvm] CVS: llvm/examples/SIMD/Makefile Makefile.common README.txt _malloc.c _malloc.h
Robert L. Bocchino Jr.
bocchino at persephone.cs.uiuc.edu
Sun Oct 23 15:50:25 PDT 2005
Changes in directory llvm/examples/SIMD:
Makefile added (r1.1.2.1)
Makefile.common added (r1.1.2.1)
README.txt added (r1.1.2.1)
_malloc.c added (r1.1.2.1)
_malloc.h added (r1.1.2.1)
---
Log message:
Examples to illustrate Vector LLVM's SIMD support.
---
Diffs of the changes: (+150 -0)
Makefile | 28 ++++++++++++++++++
Makefile.common | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
README.txt | 21 +++++++++++++
_malloc.c | 15 +++++++++
_malloc.h | 1
5 files changed, 150 insertions
Index: llvm/examples/SIMD/Makefile
diff -c /dev/null llvm/examples/SIMD/Makefile:1.1.2.1
*** /dev/null Sun Oct 23 17:50:11 2005
--- llvm/examples/SIMD/Makefile Sun Oct 23 17:49:30 2005
***************
*** 0 ****
--- 1,28 ----
+ all:
+ # Please specify altivec or sse!
+
+ altivec:
+ make -C Saxpy altivec
+ make -C InterQuant altivec
+ make -C MADFilter altivec
+ make -C RGB2YUV altivec
+ make -C Transpose altivec
+ make -C DCT altivec
+
+ sse:
+ make -C Saxpy sse
+ make -C InterQuant sse
+ make -C MADFilter sse
+ # Note that RGB2YUV doesn't currently work on SSE because of
+ # SSE's limited support for permute operations
+ make -C Transpose sse
+ make -C DCT sse
+
+ clean:
+ make -C Saxpy clean
+ make -C InterQuant clean
+ make -C MADFilter clean
+ make -C RGB2YUV clean
+ make -C Transpose clean
+ make -C DCT clean
+
Index: llvm/examples/SIMD/Makefile.common
diff -c /dev/null llvm/examples/SIMD/Makefile.common:1.1.2.1
*** /dev/null Sun Oct 23 17:50:25 2005
--- llvm/examples/SIMD/Makefile.common Sun Oct 23 17:49:30 2005
***************
*** 0 ****
--- 1,85 ----
+ LLVMSRCDIR= $(HOME)/llvm/src
+ LLVMGCCFLAGS += -I$(LLVMSRCDIR)/include/VectorC -I$(LLVMSRCDIR)/include/SIMD #-Wa,-unroll-threshold=200
+ SSECFLAGS += -I$(LLVMSRCDIR)/include/SIMD -msse2 -O2
+ ALTIVECCFLAGS += -I$(LLVMSRCDIR)/include/SIMD -faltivec -O2
+
+
+ # Specify how many runs you want here (for timing). You can also say
+ # NRUNS=n on the command line.
+ #
+ ifndef $(NRUNS)
+ NRUNS= 1
+ endif
+
+ all:
+ # Please specify altivec or sse!
+
+ altivec: altivec.handwritten altivec.vectorc
+ ./altivec.handwritten
+ ./altivec.vectorc
+
+ sse: sse.handwritten sse.vectorc
+ ./sse.handwritten
+ ./sse.vectorc
+
+ #
+ # General stuff
+ #
+ main.bc : main.c
+ llvm-gcc $(LLVMGCCFLAGS) -DNRUNS=$(NRUNS) -c -o $@ $<
+
+ $(NAME).vectorc.bc : $(NAME).vectorc.c
+ llvm-gcc $(LLVMGCCFLAGS) -c $< -o $@
+
+ $(NAME).raised.bc : $(NAME).vectorc.bc
+ opt -raisevectors < $< > $@
+
+ %.ll : %.bc
+ llvm-dis < $< > $@
+
+ clean:
+ rm -f altivec.handwritten sse.handwritten altivec.vectorc sse.vectorc *.o *.s *.bc *.exe *.ll *.cbe.c
+
+ #
+ # AltiVec-specific stuff
+ #
+ ../_malloc.bc : ../_malloc.c
+ llvm-gcc $(LLVMGCCFLAGS) -DMEMALIGN=0 -c -o $@ $<
+
+ altivec.handwritten: $(NAME).altivec.handwritten.c ../_malloc.c main.c
+ gcc $(ALTIVECCFLAGS) -DMEMALIGN=0 -DNRUNS=$(NRUNS) -o $@ $+
+
+ $(NAME).altivec.bc : $(NAME).raised.bc
+ opt < $< -altivec > $@
+
+ altivec.vectorc.bc: $(NAME).altivec.bc ../_malloc.bc main.bc
+ llvm-gcc $(LLVMGCCFLAGS) $+ -o altivec.vectorc
+
+ altivec.vectorc.cbe.c: altivec.vectorc.bc
+ llc -march=altivec-c < $< | sed 's/_2E_/_/g' > $@
+
+ altivec.vectorc: altivec.vectorc.cbe.c
+ gcc $(ALTIVECCFLAGS) -o $@ $<
+
+ #
+ # SSE-specific stuff
+ #
+ ../_malloc.memalign.bc : ../_malloc.c
+ llvm-gcc $(LLVMGCCFLAGS) -DMEMALIGN=1 -c -o $@ $<
+
+ sse.handwritten: $(NAME).sse.handwritten.c ../_malloc.c main.c
+ gcc $(SSECFLAGS) -DMEMALIGN=1 -DNRUNS=$(NRUNS) -o $@ $+
+
+ $(NAME).sse.bc : $(NAME).raised.bc
+ opt < $< -sse > $@
+
+ sse.vectorc.bc: $(NAME).sse.bc ../_malloc.memalign.bc main.bc
+ llvm-gcc $(LLVMGCCFLAGS) $+ -o sse.vectorc
+
+ sse.vectorc.cbe.c: sse.vectorc.bc
+ llc -march=sse-c < $< | sed 's/_2E_/_/g' > $@
+
+ sse.vectorc: sse.vectorc.cbe.c
+ gcc $(SSECFLAGS) -o $@ $<
+
+
Index: llvm/examples/SIMD/README.txt
diff -c /dev/null llvm/examples/SIMD/README.txt:1.1.2.1
*** /dev/null Sun Oct 23 17:50:25 2005
--- llvm/examples/SIMD/README.txt Sun Oct 23 17:49:30 2005
***************
*** 0 ****
--- 1,21 ----
+ SIMD Examples
+ =============
+
+ Rob Bocchino
+ October 23, 2005
+
+ This directory illustrates the enhanced support for SIMD operations
+ provided by Vector LLVM. It provides several benchmarks handcoded in
+ Vector C, AltiVec-C, and SSE-C, together with a build environment for
+ running and timing all three versions. Except for RGB2YUV (which
+ works only for AltiVec, because of SSE's limited support for permute
+ operations), the same Vector C version compiles to both AltiVec and
+ SSE.
+
+ To run the benchmarks on AltiVec, type make altivec in this directory.
+ To run the benchmarks on SSE, type make sse. To run the benchmarks on
+ SSE, your platform must support SSE2.
+
+ For more information on Vector C and the AltiVec and SSE C backends,
+ see the documents VectorCReference.txt and SIMDCReference.txt in the
+ directory ../../docs.
Index: llvm/examples/SIMD/_malloc.c
diff -c /dev/null llvm/examples/SIMD/_malloc.c:1.1.2.1
*** /dev/null Sun Oct 23 17:50:25 2005
--- llvm/examples/SIMD/_malloc.c Sun Oct 23 17:49:30 2005
***************
*** 0 ****
--- 1,15 ----
+ #ifndef MEMALIGN
+ #error MEMALIGN must be defined on compiler command line!
+ #endif
+
+ #if MEMALIGN
+ #include <malloc.h>
+ #endif
+
+ void *_malloc(unsigned int len) {
+ #if MEMALIGN
+ return memalign(16, len);
+ #else
+ return malloc(len);
+ #endif
+ }
Index: llvm/examples/SIMD/_malloc.h
diff -c /dev/null llvm/examples/SIMD/_malloc.h:1.1.2.1
*** /dev/null Sun Oct 23 17:50:25 2005
--- llvm/examples/SIMD/_malloc.h Sun Oct 23 17:49:30 2005
***************
*** 0 ****
--- 1 ----
+ void *_malloc(unsigned int);
More information about the llvm-commits
mailing list