diff options
Diffstat (limited to 'lib/Headers')
-rw-r--r-- | lib/Headers/CMakeLists.txt | 13 | ||||
-rw-r--r-- | lib/Headers/Makefile | 21 | ||||
-rw-r--r-- | lib/Headers/altivec.h | 5317 | ||||
-rw-r--r-- | lib/Headers/arm_neon.td | 341 | ||||
-rw-r--r-- | lib/Headers/emmintrin.h | 7 | ||||
-rw-r--r-- | lib/Headers/smmintrin.h | 16 | ||||
-rw-r--r-- | lib/Headers/stddef.h | 7 | ||||
-rw-r--r-- | lib/Headers/stdint.h | 4 | ||||
-rw-r--r-- | lib/Headers/xmmintrin.h | 6 |
9 files changed, 5271 insertions, 461 deletions
diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt index 047fdb3..97a99d6 100644 --- a/lib/Headers/CMakeLists.txt +++ b/lib/Headers/CMakeLists.txt @@ -1,6 +1,5 @@ set(files altivec.h - arm_neon.h emmintrin.h float.h iso646.h @@ -22,6 +21,14 @@ else () set(output_dir ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION}/include) endif () +# Generate arm_neon.h +set(LLVM_TARGET_DEFINITIONS ${CLANG_SOURCE_DIR}/include/clang/Basic/arm_neon.td) +tablegen(arm_neon.h.inc -gen-arm-neon) + +add_custom_command(OUTPUT ${output_dir}/arm_neon.h + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h.inc + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h.inc ${output_dir}/arm_neon.h + COMMENT "Copying clang's arm_neon.h...") foreach( f ${files} ) set( src ${CMAKE_CURRENT_SOURCE_DIR}/${f} ) @@ -33,8 +40,8 @@ foreach( f ${files} ) endforeach( f ) add_custom_target(clang-headers ALL - DEPENDS ${files}) + DEPENDS ${files} ${output_dir}/arm_neon.h) -install(FILES ${files} +install(FILES ${files} ${output_dir}/arm_neon.h PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include) diff --git a/lib/Headers/Makefile b/lib/Headers/Makefile index cb36e84..ebb8384 100644 --- a/lib/Headers/Makefile +++ b/lib/Headers/Makefile @@ -7,10 +7,15 @@ # ##===----------------------------------------------------------------------===## -LEVEL = ../../../.. -include $(LEVEL)/Makefile.common +CLANG_LEVEL := ../.. -CLANG_VERSION := $(shell cat $(PROJ_SRC_DIR)/../../VER) +BUILT_SOURCES = arm_neon.h.inc +TABLEGEN_INC_FILES_COMMON = 1 + +include $(CLANG_LEVEL)/Makefile + +CLANG_VERSION := $(word 3,$(shell grep "CLANG_VERSION " \ + $(PROJ_OBJ_DIR)/$(CLANG_LEVEL)/include/clang/Basic/Version.inc)) HeaderDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib/clang/$(CLANG_VERSION)/include @@ -19,7 +24,11 @@ HEADERS := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.h)) OBJHEADERS := $(addprefix $(HeaderDir)/, $(HEADERS)) -$(OBJHEADERS): $(HeaderDir)/%.h: $(PROJ_SRC_DIR)/%.h $(HeaderDir)/.dir +$(OBJHEADERS): $(HeaderDir)/%.h: $(PROJ_SRC_DIR)/%.h $(HeaderDir)/.dir $(HeaderDir)/arm_neon.h + $(Verb) cp $< $@ + $(Echo) Copying $(notdir $<) to build dir + +$(HeaderDir)/arm_neon.h: $(BUILT_SOURCES) $(HeaderDir)/.dir $(Verb) cp $< $@ $(Echo) Copying $(notdir $<) to build dir @@ -38,3 +47,7 @@ $(INSTHEADERS): $(PROJ_headers)/%.h: $(HeaderDir)/%.h | $(PROJ_headers) $(Echo) Installing compiler include file: $(notdir $<) install-local:: $(INSTHEADERS) + +$(ObjDir)/arm_neon.h.inc.tmp : $(CLANG_LEVEL)/include/clang/Basic/arm_neon.td $(TBLGEN) $(ObjDir)/.dir + $(Echo) "Building Clang arm_neon.h.inc with tblgen" + $(Verb) $(TableGen) -gen-arm-neon -o $(call SYSPATH, $@) $< diff --git a/lib/Headers/altivec.h b/lib/Headers/altivec.h index 1cd0db8..d3d5ad9 100644 --- a/lib/Headers/altivec.h +++ b/lib/Headers/altivec.h @@ -20,6 +20,9 @@ * \*===----------------------------------------------------------------------===*/ +// TODO: add functions for 'vector bool ..' and 'vector pixel' argument types according to +// the 'AltiVec Technology Programming Interface Manual' + #ifndef __ALTIVEC_H #define __ALTIVEC_H @@ -34,534 +37,629 @@ #define __CR6_LT 2 #define __CR6_LT_REV 3 -#define _ATTRS_o_ai __attribute__((__overloadable__, __always_inline__)) +#define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__)) + +static vector signed char __ATTRS_o_ai +vec_perm(vector signed char a, vector signed char b, vector unsigned char c); + +static vector unsigned char __ATTRS_o_ai +vec_perm(vector unsigned char a, vector unsigned char b, vector unsigned char c); + +static vector short __ATTRS_o_ai +vec_perm(vector short a, vector short b, vector unsigned char c); + +static vector unsigned short __ATTRS_o_ai +vec_perm(vector unsigned short a, vector unsigned short b, vector unsigned char c); + +static vector int __ATTRS_o_ai +vec_perm(vector int a, vector int b, vector unsigned char c); + +static vector unsigned int __ATTRS_o_ai +vec_perm(vector unsigned int a, vector unsigned int b, vector unsigned char c); + +static vector float __ATTRS_o_ai +vec_perm(vector float a, vector float b, vector unsigned char c); /* vec_abs */ -#define __builtin_vec_abs vec_abs #define __builtin_altivec_abs_v16qi vec_abs #define __builtin_altivec_abs_v8hi vec_abs #define __builtin_altivec_abs_v4si vec_abs -static vector signed char _ATTRS_o_ai +static vector signed char __ATTRS_o_ai vec_abs(vector signed char a) { return __builtin_altivec_vmaxsb(a, -a); } -static vector signed short _ATTRS_o_ai +static vector signed short __ATTRS_o_ai vec_abs(vector signed short a) { return __builtin_altivec_vmaxsh(a, -a); } -static vector signed int _ATTRS_o_ai +static vector signed int __ATTRS_o_ai vec_abs(vector signed int a) { return __builtin_altivec_vmaxsw(a, -a); } -static vector float _ATTRS_o_ai +static vector float __ATTRS_o_ai vec_abs(vector float a) { - vector unsigned int res = (vector unsigned int)a & - (vector unsigned int)(0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF); + vector unsigned int res = (vector unsigned int)a & (vector unsigned int)(0x7FFFFFFF); return (vector float)res; } /* vec_abss */ -#define __builtin_vec_abss vec_abss #define __builtin_altivec_abss_v16qi vec_abss #define __builtin_altivec_abss_v8hi vec_abss #define __builtin_altivec_abss_v4si vec_abss -static vector signed char _ATTRS_o_ai +static vector signed char __ATTRS_o_ai vec_abss(vector signed char a) { - return __builtin_altivec_vmaxsb(a, __builtin_altivec_vsubsbs( - (vector signed char)(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), a)); + return __builtin_altivec_vmaxsb(a, __builtin_altivec_vsubsbs((vector signed char)(0), a)); } -static vector signed short _ATTRS_o_ai +static vector signed short __ATTRS_o_ai vec_abss(vector signed short a) { - return __builtin_altivec_vmaxsh(a, __builtin_altivec_vsubshs( - (vector signed short)(0, 0, 0, 0, 0, 0, 0, 0), a)); + return __builtin_altivec_vmaxsh(a, __builtin_altivec_vsubshs((vector signed short)(0), a)); } -static vector signed int _ATTRS_o_ai +static vector signed int __ATTRS_o_ai vec_abss(vector signed int a) { - return __builtin_altivec_vmaxsw(a, __builtin_altivec_vsubsws( - (vector signed int)(0, 0, 0, 0), a)); + return __builtin_altivec_vmaxsw(a, __builtin_altivec_vsubsws((vector signed int)(0), a)); } /* vec_add */ -#define __builtin_altivec_vaddubm vec_add -#define __builtin_altivec_vadduhm vec_add -#define __builtin_altivec_vadduwm vec_add -#define __builtin_altivec_vaddfp vec_add -#define __builtin_vec_vaddubm vec_add -#define __builtin_vec_vadduhm vec_add -#define __builtin_vec_vadduwm vec_add -#define __builtin_vec_vaddfp vec_add -#define vec_vaddubm vec_add -#define vec_vadduhm vec_add -#define vec_vadduwm vec_add -#define vec_vaddfp vec_add - -static vector signed char _ATTRS_o_ai +static vector signed char __ATTRS_o_ai vec_add(vector signed char a, vector signed char b) { return a + b; } -static vector unsigned char _ATTRS_o_ai +static vector unsigned char __ATTRS_o_ai vec_add(vector unsigned char a, vector unsigned char b) { return a + b; } -static vector short _ATTRS_o_ai +static vector short __ATTRS_o_ai vec_add(vector short a, vector short b) { return a + b; } -static vector unsigned short _ATTRS_o_ai +static vector unsigned short __ATTRS_o_ai vec_add(vector unsigned short a, vector unsigned short b) { return a + b; } -static vector int _ATTRS_o_ai +static vector int __ATTRS_o_ai vec_add(vector int a, vector int b) { return a + b; } -static vector unsigned int _ATTRS_o_ai +static vector unsigned int __ATTRS_o_ai vec_add(vector unsigned int a, vector unsigned int b) { return a + b; } -static vector float _ATTRS_o_ai +static vector float __ATTRS_o_ai vec_add(vector float a, vector float b) { return a + b; } +/* vec_vaddubm */ + +#define __builtin_altivec_vaddubm vec_vaddubm + +static vector signed char __ATTRS_o_ai +vec_vaddubm(vector signed char a, vector signed char b) +{ + return a + b; +} + +static vector unsigned char __ATTRS_o_ai +vec_vaddubm(vector unsigned char a, vector unsigned char b) +{ + return a + b; +} + +/* vec_vadduhm */ + +#define __builtin_altivec_vadduhm vec_vadduhm + +static vector short __ATTRS_o_ai +vec_vadduhm(vector short a, vector short b) +{ + return a + b; +} + +static vector unsigned short __ATTRS_o_ai +vec_vadduhm(vector unsigned short a, vector unsigned short b) +{ + return a + b; +} + +/* vec_vadduwm */ + +#define __builtin_altivec_vadduwm vec_vadduwm + +static vector int __ATTRS_o_ai +vec_vadduwm(vector int a, vector int b) +{ + return a + b; +} + +static vector unsigned int __ATTRS_o_ai +vec_vadduwm(vector unsigned int a, vector unsigned int b) +{ + return a + b; +} + +/* vec_vaddfp */ + +#define __builtin_altivec_vaddfp vec_vaddfp + +static vector float __attribute__((__always_inline__)) +vec_vaddfp(vector float a, vector float b) +{ + return a + b; +} + /* vec_addc */ -#define __builtin_vec_addc __builtin_altivec_vaddcuw -#define vec_vaddcuw __builtin_altivec_vaddcuw -#define vec_addc __builtin_altivec_vaddcuw +static vector unsigned int __attribute__((__always_inline__)) +vec_addc(vector unsigned int a, vector unsigned int b) +{ + return __builtin_altivec_vaddcuw(a, b); +} + +/* vec_vaddcuw */ + +static vector unsigned int __attribute__((__always_inline__)) +vec_vaddcuw(vector unsigned int a, vector unsigned int b) +{ + return __builtin_altivec_vaddcuw(a, b); +} /* vec_adds */ -#define __builtin_vec_vaddsbs __builtin_altivec_vaddsbs -#define __builtin_vec_vaddubs __builtin_altivec_vaddubs -#define __builtin_vec_vaddshs __builtin_altivec_vaddshs -#define __builtin_vec_vadduhs __builtin_altivec_vadduhs -#define __builtin_vec_vaddsws __builtin_altivec_vaddsws -#define __builtin_vec_vadduws __builtin_altivec_vadduws -#define vec_vaddsbs __builtin_altivec_vaddsbs -#define vec_vaddubs __builtin_altivec_vaddubs -#define vec_vaddshs __builtin_altivec_vaddshs -#define vec_vadduhs __builtin_altivec_vadduhs -#define vec_vaddsws __builtin_altivec_vaddsws -#define vec_vadduws __builtin_altivec_vadduws - -static vector signed char _ATTRS_o_ai +static vector signed char __ATTRS_o_ai vec_adds(vector signed char a, vector signed char b) { return __builtin_altivec_vaddsbs(a, b); } -static vector unsigned char _ATTRS_o_ai +static vector unsigned char __ATTRS_o_ai vec_adds(vector unsigned char a, vector unsigned char b) { return __builtin_altivec_vaddubs(a, b); } -static vector short _ATTRS_o_ai +static vector short __ATTRS_o_ai vec_adds(vector short a, vector short b) { return __builtin_altivec_vaddshs(a, b); } -static vector unsigned short _ATTRS_o_ai +static vector unsigned short __ATTRS_o_ai vec_adds(vector unsigned short a, vector unsigned short b) { return __builtin_altivec_vadduhs(a, b); } -static vector int _ATTRS_o_ai +static vector int __ATTRS_o_ai vec_adds(vector int a, vector int b) { return __builtin_altivec_vaddsws(a, b); } -static vector unsigned int _ATTRS_o_ai +static vector unsigned int __ATTRS_o_ai vec_adds(vector unsigned int a, vector unsigned int b) { return __builtin_altivec_vadduws(a, b); } -/* vec_sub */ +/* vec_vaddsbs */ -#define __builtin_altivec_vsububm vec_sub -#define __builtin_altivec_vsubuhm vec_sub -#define __builtin_altivec_vsubuwm vec_sub -#define __builtin_altivec_vsubfp vec_sub -#define __builtin_vec_vsububm vec_sub -#define __builtin_vec_vsubuhm vec_sub -#define __builtin_vec_vsubuwm vec_sub -#define __builtin_vec_vsubfp vec_sub -#define vec_vsububm vec_sub -#define vec_vsubuhm vec_sub -#define vec_vsubuwm vec_sub -#define vec_vsubfp vec_sub - -static vector signed char _ATTRS_o_ai -vec_sub(vector signed char a, vector signed char b) +static vector signed char __attribute__((__always_inline__)) +vec_vaddsbs(vector signed char a, vector signed char b) { - return a - b; + return __builtin_altivec_vaddsbs(a, b); } -static vector unsigned char _ATTRS_o_ai -vec_sub(vector unsigned char a, vector unsigned char b) +/* vec_vaddubs */ + +static vector unsigned char __attribute__((__always_inline__)) +vec_vaddubs(vector unsigned char a, vector unsigned char b) { - return a - b; + return __builtin_altivec_vaddubs(a, b); } -static vector short _ATTRS_o_ai -vec_sub(vector short a, vector short b) +/* vec_vaddshs */ + +static vector short __attribute__((__always_inline__)) +vec_vaddshs(vector short a, vector short b) { - return a - b; + return __builtin_altivec_vaddshs(a, b); } -static vector unsigned short _ATTRS_o_ai -vec_sub(vector unsigned short a, vector unsigned short b) +/* vec_vadduhs */ + +static vector unsigned short __attribute__((__always_inline__)) +vec_vadduhs(vector unsigned short a, vector unsigned short b) { - return a - b; + return __builtin_altivec_vadduhs(a, b); } -static vector int _ATTRS_o_ai -vec_sub(vector int a, vector int b) +/* vec_vaddsws */ + +static vector int __attribute__((__always_inline__)) +vec_vaddsws(vector int a, vector int b) { - return a - b; + return __builtin_altivec_vaddsws(a, b); } -static vector unsigned int _ATTRS_o_ai -vec_sub(vector unsigned int a, vector unsigned int b) +/* vec_vadduws */ + +static vector unsigned int __attribute__((__always_inline__)) +vec_vadduws(vector unsigned int a, vector unsigned int b) { - return a - b; + return __builtin_altivec_vadduws(a, b); } -static vector float _ATTRS_o_ai -vec_sub(vector float a, vector float b) +/* vec_and */ + +#define __builtin_altivec_vand vec_and + +static vector signed char __ATTRS_o_ai +vec_and(vector signed char a, vector signed char b) { - return a - b; + return a & b; } -/* vec_subs */ +static vector unsigned char __ATTRS_o_ai +vec_and(vector unsigned char a, vector unsigned char b) +{ + return a & b; +} -#define __builtin_vec_vsubsbs __builtin_altivec_vsubsbs -#define __builtin_vec_vsububs __builtin_altivec_vsububs -#define __builtin_vec_vsubshs __builtin_altivec_vsubshs -#define __builtin_vec_vsubuhs __builtin_altivec_vsubuhs -#define __builtin_vec_vsubsws __builtin_altivec_vsubsws -#define __builtin_vec_vsubuws __builtin_altivec_vsubuws -#define vec_vsubsbs __builtin_altivec_vsubsbs -#define vec_vsububs __builtin_altivec_vsububs -#define vec_vsubshs __builtin_altivec_vsubshs -#define vec_vsubuhs __builtin_altivec_vsubuhs -#define vec_vsubsws __builtin_altivec_vsubsws -#define vec_vsubuws __builtin_altivec_vsubuws - -static vector signed char _ATTRS_o_ai -vec_subs(vector signed char a, vector signed char b) +static vector short __ATTRS_o_ai +vec_and(vector short a, vector short b) { - return __builtin_altivec_vsubsbs(a, b); + return a & b; } -static vector unsigned char _ATTRS_o_ai -vec_subs(vector unsigned char a, vector unsigned char b) +static vector unsigned short __ATTRS_o_ai +vec_and(vector unsigned short a, vector unsigned short b) { - return __builtin_altivec_vsububs(a, b); + return a & b; } -static vector short _ATTRS_o_ai -vec_subs(vector short a, vector short b) +static vector int __ATTRS_o_ai +vec_and(vector int a, vector int b) { - return __builtin_altivec_vsubshs(a, b); + return a & b; } -static vector unsigned short _ATTRS_o_ai -vec_subs(vector unsigned short a, vector unsigned short b) +static vector unsigned int __ATTRS_o_ai +vec_and(vector unsigned int a, vector unsigned int b) { - return __builtin_altivec_vsubuhs(a, b); + return a & b; } -static vector int _ATTRS_o_ai -vec_subs(vector int a, vector int b) +static vector float __ATTRS_o_ai +vec_and(vector float a, vector float b) { - return __builtin_altivec_vsubsws(a, b); + vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b; + return (vector float)res; } -static vector unsigned int _ATTRS_o_ai -vec_subs(vector unsigned int a, vector unsigned int b) +/* vec_vand */ + +static vector signed char __ATTRS_o_ai +vec_vand(vector signed char a, vector signed char b) { - return __builtin_altivec_vsubuws(a, b); + return a & b; } -/* vec_avg */ +static vector unsigned char __ATTRS_o_ai +vec_vand(vector unsigned char a, vector unsigned char b) +{ + return a & b; +} -#define __builtin_vec_vavgsb __builtin_altivec_vavgsb -#define __builtin_vec_vavgub __builtin_altivec_vavgub -#define __builtin_vec_vavgsh __builtin_altivec_vavgsh -#define __builtin_vec_vavguh __builtin_altivec_vavguh -#define __builtin_vec_vavgsw __builtin_altivec_vavgsw -#define __builtin_vec_vavguw __builtin_altivec_vavguw -#define vec_vavgsb __builtin_altivec_vavgsb -#define vec_vavgub __builtin_altivec_vavgub -#define vec_vavgsh __builtin_altivec_vavgsh -#define vec_vavguh __builtin_altivec_vavguh -#define vec_vavgsw __builtin_altivec_vavgsw -#define vec_vavguw __builtin_altivec_vavguw - -static vector signed char _ATTRS_o_ai -vec_avg(vector signed char a, vector signed char b) +static vector short __ATTRS_o_ai +vec_vand(vector short a, vector short b) { - return __builtin_altivec_vavgsb(a, b); + return a & b; } -static vector unsigned char _ATTRS_o_ai -vec_avg(vector unsigned char a, vector unsigned char b) +static vector unsigned short __ATTRS_o_ai +vec_vand(vector unsigned short a, vector unsigned short b) { - return __builtin_altivec_vavgub(a, b); + return a & b; } -static vector short _ATTRS_o_ai -vec_avg(vector short a, vector short b) +static vector int __ATTRS_o_ai +vec_vand(vector int a, vector int b) { - return __builtin_altivec_vavgsh(a, b); + return a & b; } -static vector unsigned short _ATTRS_o_ai -vec_avg(vector unsigned short a, vector unsigned short b) +static vector unsigned int __ATTRS_o_ai +vec_vand(vector unsigned int a, vector unsigned int b) { - return __builtin_altivec_vavguh(a, b); + return a & b; } -static vector int _ATTRS_o_ai -vec_avg(vector int a, vector int b) +static vector float __ATTRS_o_ai +vec_vand(vector float a, vector float b) { - return __builtin_altivec_vavgsw(a, b); + vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b; + return (vector float)res; } -static vector unsigned int _ATTRS_o_ai -vec_avg(vector unsigned int a, vector unsigned int b) +/* vec_andc */ + +#define __builtin_altivec_vandc vec_andc + +static vector signed char __ATTRS_o_ai +vec_andc(vector signed char a, vector signed char b) { - return __builtin_altivec_vavguw(a, b); + return a & ~b; } -/* vec_st */ +static vector unsigned char __ATTRS_o_ai +vec_andc(vector unsigned char a, vector unsigned char b) +{ + return a & ~b; +} -#define __builtin_vec_st vec_st -#define vec_stvx vec_st +static vector short __ATTRS_o_ai +vec_andc(vector short a, vector short b) +{ + return a & ~b; +} -static void _ATTRS_o_ai -vec_st(vector signed char a, int b, vector signed char *c) +static vector unsigned short __ATTRS_o_ai +vec_andc(vector unsigned short a, vector unsigned short b) { - __builtin_altivec_stvx((vector int)a, b, (void *)c); + return a & ~b; } -static void _ATTRS_o_ai -vec_st(vector unsigned char a, int b, vector unsigned char *c) +static vector int __ATTRS_o_ai +vec_andc(vector int a, vector int b) { - __builtin_altivec_stvx((vector int)a, b, (void *)c); + return a & ~b; } -static void _ATTRS_o_ai -vec_st(vector short a, int b, vector short *c) +static vector unsigned int __ATTRS_o_ai +vec_andc(vector unsigned int a, vector unsigned int b) { - __builtin_altivec_stvx((vector int)a, b, (void *)c); + return a & ~b; } -static void _ATTRS_o_ai -vec_st(vector unsigned short a, int b, vector unsigned short *c) +static vector float __ATTRS_o_ai +vec_andc(vector float a, vector float b) { - __builtin_altivec_stvx((vector int)a, b, (void *)c); + vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b; + return (vector float)res; } -static void _ATTRS_o_ai -vec_st(vector int a, int b, vector int *c) +/* vec_vandc */ + +static vector signed char __ATTRS_o_ai +vec_vandc(vector signed char a, vector signed char b) { - __builtin_altivec_stvx(a, b, (void *)c); + return a & ~b; } -static void _ATTRS_o_ai -vec_st(vector unsigned int a, int b, vector unsigned int *c) +static vector unsigned char __ATTRS_o_ai +vec_vandc(vector unsigned char a, vector unsigned char b) { - __builtin_altivec_stvx((vector int)a, b, (void *)c); + return a & ~b; } -static void _ATTRS_o_ai -vec_st(vector float a, int b, vector float *c) +static vector short __ATTRS_o_ai +vec_vandc(vector short a, vector short b) { - __builtin_altivec_stvx((vector int)a, b, (void *)c); + return a & ~b; } -/* vec_stl */ +static vector unsigned short __ATTRS_o_ai +vec_vandc(vector unsigned short a, vector unsigned short b) +{ + return a & ~b; +} -#define __builtin_vec_stl vec_stl -#define vec_stvxl vec_stl +static vector int __ATTRS_o_ai +vec_vandc(vector int a, vector int b) +{ + return a & ~b; +} -static void _ATTRS_o_ai -vec_stl(vector signed char a, int b, vector signed char *c) +static vector unsigned int __ATTRS_o_ai +vec_vandc(vector unsigned int a, vector unsigned int b) { - __builtin_altivec_stvxl((vector int)a, b, (void *)c); + return a & ~b; } -static void _ATTRS_o_ai -vec_stl(vector unsigned char a, int b, vector unsigned char *c) +static vector float __ATTRS_o_ai +vec_vandc(vector float a, vector float b) { - __builtin_altivec_stvxl((vector int)a, b, (void *)c); + vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b; + return (vector float)res; } -static void _ATTRS_o_ai -vec_stl(vector short a, int b, vector short *c) +/* vec_avg */ + +static vector signed char __ATTRS_o_ai +vec_avg(vector signed char a, vector signed char b) { - __builtin_altivec_stvxl((vector int)a, b, (void *)c); + return __builtin_altivec_vavgsb(a, b); } -static void _ATTRS_o_ai -vec_stl(vector unsigned short a, int b, vector unsigned short *c) +static vector unsigned char __ATTRS_o_ai +vec_avg(vector unsigned char a, vector unsigned char b) { - __builtin_altivec_stvxl((vector int)a, b, (void *)c); + return __builtin_altivec_vavgub(a, b); } -static void _ATTRS_o_ai -vec_stl(vector int a, int b, vector int *c) +static vector short __ATTRS_o_ai +vec_avg(vector short a, vector short b) { - __builtin_altivec_stvxl(a, b, (void *)c); + return __builtin_altivec_vavgsh(a, b); } -static void _ATTRS_o_ai -vec_stl(vector unsigned int a, int b, vector unsigned int *c) +static vector unsigned short __ATTRS_o_ai +vec_avg(vector unsigned short a, vector unsigned short b) { - __builtin_altivec_stvxl((vector int)a, b, (void *)c); + return __builtin_altivec_vavguh(a, b); } -static void _ATTRS_o_ai -vec_stl(vector float a, int b, vector float *c) +static vector int __ATTRS_o_ai +vec_avg(vector int a, vector int b) { - __builtin_altivec_stvxl((vector int)a, b, (void *)c); + return __builtin_altivec_vavgsw(a, b); } -/* vec_ste */ +static vector unsigned int __ATTRS_o_ai +vec_avg(vector unsigned int a, vector unsigned int b) +{ + return __builtin_altivec_vavguw(a, b); +} -#define __builtin_vec_stvebx __builtin_altivec_stvebx -#define __builtin_vec_stvehx __builtin_altivec_stvehx -#define __builtin_vec_stvewx __builtin_altivec_stvewx -#define vec_stvebx __builtin_altivec_stvebx -#define vec_stvehx __builtin_altivec_stvehx -#define vec_stvewx __builtin_altivec_stvewx +/* vec_vavgsb */ -static void _ATTRS_o_ai -vec_ste(vector signed char a, int b, vector signed char *c) +static vector signed char __attribute__((__always_inline__)) +vec_vavgsb(vector signed char a, vector signed char b) { - __builtin_altivec_stvebx((vector char)a, b, (void *)c); + return __builtin_altivec_vavgsb(a, b); } -static void _ATTRS_o_ai -vec_ste(vector unsigned char a, int b, vector unsigned char *c) +/* vec_vavgub */ + +static vector unsigned char __attribute__((__always_inline__)) +vec_vavgub(vector unsigned char a, vector unsigned char b) { - __builtin_altivec_stvebx((vector char)a, b, (void *)c); + return __builtin_altivec_vavgub(a, b); } -static void _ATTRS_o_ai -vec_ste(vector short a, int b, vector short *c) +/* vec_vavgsh */ + +static vector short __attribute__((__always_inline__)) +vec_vavgsh(vector short a, vector short b) { - __builtin_altivec_stvehx(a, b, (void *)c); + return __builtin_altivec_vavgsh(a, b); } -static void _ATTRS_o_ai -vec_ste(vector unsigned short a, int b, vector unsigned short *c) +/* vec_vavguh */ + +static vector unsigned short __attribute__((__always_inline__)) +vec_vavguh(vector unsigned short a, vector unsigned short b) { - __builtin_altivec_stvehx((vector short)a, b, (void *)c); + return __builtin_altivec_vavguh(a, b); } -static void _ATTRS_o_ai -vec_ste(vector int a, int b, vector int *c) +/* vec_vavgsw */ + +static vector int __attribute__((__always_inline__)) +vec_vavgsw(vector int a, vector int b) +{ + return __builtin_altivec_vavgsw(a, b); +} + +/* vec_vavguw */ + +static vector unsigned int __attribute__((__always_inline__)) +vec_vavguw(vector unsigned int a, vector unsigned int b) { - __builtin_altivec_stvewx(a, b, (void *)c); + return __builtin_altivec_vavguw(a, b); } -static void _ATTRS_o_ai -vec_ste(vector unsigned int a, int b, vector unsigned int *c) +/* vec_ceil */ + +static vector float __attribute__((__always_inline__)) +vec_ceil(vector float a) { - __builtin_altivec_stvewx((vector int)a, b, (void *)c); + return __builtin_altivec_vrfip(a); } -static void _ATTRS_o_ai -vec_ste(vector float a, int b, vector float *c) +/* vec_vrfip */ + +static vector float __attribute__((__always_inline__)) +vec_vrfip(vector float a) { - __builtin_altivec_stvewx((vector int)a, b, (void *)c); + return __builtin_altivec_vrfip(a); } /* vec_cmpb */ -#define vec_cmpb __builtin_altivec_vcmpbfp -#define vec_vcmpbfp __builtin_altivec_vcmpbfp -#define __builtin_vec_cmpb __builtin_altivec_vcmpbfp +static vector int __attribute__((__always_inline__)) +vec_cmpb(vector float a, vector float b) +{ + return __builtin_altivec_vcmpbfp(a, b); +} + +/* vec_vcmpbfp */ -/* vec_cmpeq */ +static vector int __attribute__((__always_inline__)) +vec_vcmpbfp(vector float a, vector float b) +{ + return __builtin_altivec_vcmpbfp(a, b); +} -#define __builtin_vec_cmpeq vec_cmpeq +/* vec_cmpeq */ -static vector /*bool*/ char _ATTRS_o_ai +static vector /*bool*/ char __ATTRS_o_ai vec_cmpeq(vector signed char a, vector signed char b) { return __builtin_altivec_vcmpequb((vector char)a, (vector char)b); } -static vector /*bool*/ char _ATTRS_o_ai +static vector /*bool*/ char __ATTRS_o_ai vec_cmpeq(vector unsigned char a, vector unsigned char b) { return __builtin_altivec_vcmpequb((vector char)a, (vector char)b); } -static vector /*bool*/ short _ATTRS_o_ai +static vector /*bool*/ short __ATTRS_o_ai vec_cmpeq(vector short a, vector short b) { return __builtin_altivec_vcmpequh(a, b); } -static vector /*bool*/ short _ATTRS_o_ai +static vector /*bool*/ short __ATTRS_o_ai vec_cmpeq(vector unsigned short a, vector unsigned short b) { return __builtin_altivec_vcmpequh((vector short)a, (vector short)b); } -static vector /*bool*/ int _ATTRS_o_ai +static vector /*bool*/ int __ATTRS_o_ai vec_cmpeq(vector int a, vector int b) { return __builtin_altivec_vcmpequw(a, b); } -static vector /*bool*/ int _ATTRS_o_ai +static vector /*bool*/ int __ATTRS_o_ai vec_cmpeq(vector unsigned int a, vector unsigned int b) { return __builtin_altivec_vcmpequw((vector int)a, (vector int)b); } -static vector /*bool*/ int _ATTRS_o_ai +static vector /*bool*/ int __ATTRS_o_ai vec_cmpeq(vector float a, vector float b) { return __builtin_altivec_vcmpeqfp(a, b); @@ -569,72 +667,121 @@ vec_cmpeq(vector float a, vector float b) /* vec_cmpge */ -#define vec_cmpge __builtin_altivec_vcmpgefp -#define vec_vcmpgefp __builtin_altivec_vcmpgefp -#define __builtin_vec_cmpge __builtin_altivec_vcmpgefp +static vector /*bool*/ int __attribute__((__always_inline__)) +vec_cmpge(vector float a, vector float b) +{ + return __builtin_altivec_vcmpgefp(a, b); +} + +/* vec_vcmpgefp */ + +static vector /*bool*/ int __attribute__((__always_inline__)) +vec_vcmpgefp(vector float a, vector float b) +{ + return __builtin_altivec_vcmpgefp(a, b); +} /* vec_cmpgt */ -#define vec_vcmpgtsb __builtin_altivec_vcmpgtsb -#define vec_vcmpgtub __builtin_altivec_vcmpgtub -#define vec_vcmpgtsh __builtin_altivec_vcmpgtsh -#define vec_vcmpgtuh __builtin_altivec_vcmpgtuh -#define vec_vcmpgtsw __builtin_altivec_vcmpgtsw -#define vec_vcmpgtuw __builtin_altivec_vcmpgtuw -#define vec_vcmpgtfp __builtin_altivec_vcmpgtfp -#define __builtin_vec_vcmpgtsb __builtin_altivec_vcmpgtsb -#define __builtin_vec_vcmpgtub __builtin_altivec_vcmpgtub -#define __builtin_vec_vcmpgtsh __builtin_altivec_vcmpgtsh -#define __builtin_vec_vcmpgtuh __builtin_altivec_vcmpgtuh -#define __builtin_vec_vcmpgtsw __builtin_altivec_vcmpgtsw -#define __builtin_vec_vcmpgtuw __builtin_altivec_vcmpgtuw -#define __builtin_vec_vcmpgtfp __builtin_altivec_vcmpgtfp - -static vector /*bool*/ char _ATTRS_o_ai +static vector /*bool*/ char __ATTRS_o_ai vec_cmpgt(vector signed char a, vector signed char b) { return __builtin_altivec_vcmpgtsb(a, b); } -static vector /*bool*/ char _ATTRS_o_ai +static vector /*bool*/ char __ATTRS_o_ai vec_cmpgt(vector unsigned char a, vector unsigned char b) { return __builtin_altivec_vcmpgtub(a, b); } -static vector /*bool*/ short _ATTRS_o_ai +static vector /*bool*/ short __ATTRS_o_ai vec_cmpgt(vector short a, vector short b) { return __builtin_altivec_vcmpgtsh(a, b); } -static vector /*bool*/ short _ATTRS_o_ai +static vector /*bool*/ short __ATTRS_o_ai vec_cmpgt(vector unsigned short a, vector unsigned short b) { return __builtin_altivec_vcmpgtuh(a, b); } -static vector /*bool*/ int _ATTRS_o_ai +static vector /*bool*/ int __ATTRS_o_ai vec_cmpgt(vector int a, vector int b) { return __builtin_altivec_vcmpgtsw(a, b); } -static vector /*bool*/ int _ATTRS_o_ai +static vector /*bool*/ int __ATTRS_o_ai vec_cmpgt(vector unsigned int a, vector unsigned int b) { return __builtin_altivec_vcmpgtuw(a, b); } -static vector /*bool*/ int _ATTRS_o_ai +static vector /*bool*/ int __ATTRS_o_ai vec_cmpgt(vector float a, vector float b) { return __builtin_altivec_vcmpgtfp(a, b); } -/* vec_cmple */ +/* vec_vcmpgtsb */ -#define __builtin_vec_cmple vec_cmple +static vector /*bool*/ char __attribute__((__always_inline__)) +vec_vcmpgtsb(vector signed char a, vector signed char b) +{ + return __builtin_altivec_vcmpgtsb(a, b); +} + +/* vec_vcmpgtub */ + +static vector /*bool*/ char __attribute__((__always_inline__)) +vec_vcmpgtub(vector unsigned char a, vector unsigned char b) +{ + return __builtin_altivec_vcmpgtub(a, b); +} + +/* vec_vcmpgtsh */ + +static vector /*bool*/ short __attribute__((__always_inline__)) +vec_vcmpgtsh(vector short a, vector short b) +{ + return __builtin_altivec_vcmpgtsh(a, b); +} + +/* vec_vcmpgtuh */ + +static vector /*bool*/ short __attribute__((__always_inline__)) +vec_vcmpgtuh(vector unsigned short a, vector unsigned short b) +{ + return __builtin_altivec_vcmpgtuh(a, b); +} + +/* vec_vcmpgtsw */ + +static vector /*bool*/ int __attribute__((__always_inline__)) +vec_vcmpgtsw(vector int a, vector int b) +{ + return __builtin_altivec_vcmpgtsw(a, b); +} + +/* vec_vcmpgtuw */ + +static vector /*bool*/ int __attribute__((__always_inline__)) +vec_vcmpgtuw(vector unsigned int a, vector unsigned int b) +{ + return __builtin_altivec_vcmpgtuw(a, b); +} + +/* vec_vcmpgtfp */ + +static vector /*bool*/ int __attribute__((__always_inline__)) +vec_vcmpgtfp(vector float a, vector float b) +{ + return __builtin_altivec_vcmpgtfp(a, b); +} + +/* vec_cmple */ static vector /*bool*/ int __attribute__((__always_inline__)) vec_cmple(vector float a, vector float b) @@ -644,239 +791,4533 @@ vec_cmple(vector float a, vector float b) /* vec_cmplt */ -#define __builtin_vec_cmplt vec_cmplt - -static vector /*bool*/ char _ATTRS_o_ai +static vector /*bool*/ char __ATTRS_o_ai vec_cmplt(vector signed char a, vector signed char b) { return __builtin_altivec_vcmpgtsb(b, a); } -static vector /*bool*/ char _ATTRS_o_ai +static vector /*bool*/ char __ATTRS_o_ai vec_cmplt(vector unsigned char a, vector unsigned char b) { return __builtin_altivec_vcmpgtub(b, a); } -static vector /*bool*/ short _ATTRS_o_ai +static vector /*bool*/ short __ATTRS_o_ai vec_cmplt(vector short a, vector short b) { return __builtin_altivec_vcmpgtsh(b, a); } -static vector /*bool*/ short _ATTRS_o_ai +static vector /*bool*/ short __ATTRS_o_ai vec_cmplt(vector unsigned short a, vector unsigned short b) { return __builtin_altivec_vcmpgtuh(b, a); } -static vector /*bool*/ int _ATTRS_o_ai +static vector /*bool*/ int __ATTRS_o_ai vec_cmplt(vector int a, vector int b) { return __builtin_altivec_vcmpgtsw(b, a); } -static vector /*bool*/ int _ATTRS_o_ai +static vector /*bool*/ int __ATTRS_o_ai vec_cmplt(vector unsigned int a, vector unsigned int b) { return __builtin_altivec_vcmpgtuw(b, a); } -static vector /*bool*/ int _ATTRS_o_ai +static vector /*bool*/ int __ATTRS_o_ai vec_cmplt(vector float a, vector float b) { return __builtin_altivec_vcmpgtfp(b, a); } +/* vec_ctf */ + +static vector float __ATTRS_o_ai +vec_ctf(vector int a, int b) +{ + return __builtin_altivec_vcfsx(a, b); +} + +static vector float __ATTRS_o_ai +vec_ctf(vector unsigned int a, int b) +{ + return __builtin_altivec_vcfux((vector int)a, b); +} + +/* vec_vcfsx */ + +static vector float __attribute__((__always_inline__)) +vec_vcfsx(vector int a, int b) +{ + return __builtin_altivec_vcfsx(a, b); +} + +/* vec_vcfux */ + +static vector float __attribute__((__always_inline__)) +vec_vcfux(vector unsigned int a, int b) +{ + return __builtin_altivec_vcfux((vector int)a, b); +} + +/* vec_cts */ + +static vector int __attribute__((__always_inline__)) +vec_cts(vector float a, int b) +{ + return __builtin_altivec_vctsxs(a, b); +} + +/* vec_vctsxs */ + +static vector int __attribute__((__always_inline__)) +vec_vctsxs(vector float a, int b) +{ + return __builtin_altivec_vctsxs(a, b); +} + +/* vec_ctu */ + +static vector unsigned int __attribute__((__always_inline__)) +vec_ctu(vector float a, int b) +{ + return __builtin_altivec_vctuxs(a, b); +} + +/* vec_vctuxs */ + +static vector unsigned int __attribute__((__always_inline__)) +vec_vctuxs(vector float a, int b) +{ + return __builtin_altivec_vctuxs(a, b); +} + +/* vec_dss */ + +static void __attribute__((__always_inline__)) +vec_dss(int a) +{ + __builtin_altivec_dss(a); +} + +/* vec_dssall */ + +static void __attribute__((__always_inline__)) +vec_dssall(void) +{ + __builtin_altivec_dssall(); +} + +/* vec_dst */ + +static void __attribute__((__always_inline__)) +vec_dst(void *a, int b, int c) +{ + __builtin_altivec_dst(a, b, c); +} + +/* vec_dstst */ + +static void __attribute__((__always_inline__)) +vec_dstst(void *a, int b, int c) +{ + __builtin_altivec_dstst(a, b, c); +} + +/* vec_dststt */ + +static void __attribute__((__always_inline__)) +vec_dststt(void *a, int b, int c) +{ + __builtin_altivec_dststt(a, b, c); +} + +/* vec_dstt */ + +static void __attribute__((__always_inline__)) +vec_dstt(void *a, int b, int c) +{ + __builtin_altivec_dstt(a, b, c); +} + +/* vec_expte */ + +static vector float __attribute__((__always_inline__)) +vec_expte(vector float a) +{ + return __builtin_altivec_vexptefp(a); +} + +/* vec_vexptefp */ + +static vector float __attribute__((__always_inline__)) +vec_vexptefp(vector float a) +{ + return __builtin_altivec_vexptefp(a); +} + +/* vec_floor */ + +static vector float __attribute__((__always_inline__)) +vec_floor(vector float a) +{ + return __builtin_altivec_vrfim(a); +} + +/* vec_vrfim */ + +static vector float __attribute__((__always_inline__)) +vec_vrfim(vector float a) +{ + return __builtin_altivec_vrfim(a); +} + +/* vec_ld */ + +static vector signed char __ATTRS_o_ai +vec_ld(int a, vector signed char *b) +{ + return (vector signed char)__builtin_altivec_lvx(a, b); +} + +static vector signed char __ATTRS_o_ai +vec_ld(int a, signed char *b) +{ + return (vector signed char)__builtin_altivec_lvx(a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_ld(int a, vector unsigned char *b) +{ + return (vector unsigned char)__builtin_altivec_lvx(a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_ld(int a, unsigned char *b) +{ + return (vector unsigned char)__builtin_altivec_lvx(a, b); +} + +static vector short __ATTRS_o_ai +vec_ld(int a, vector short *b) +{ + return (vector short)__builtin_altivec_lvx(a, b); +} + +static vector short __ATTRS_o_ai +vec_ld(int a, short *b) +{ + return (vector short)__builtin_altivec_lvx(a, b); +} + +static vector unsigned short __ATTRS_o_ai +vec_ld(int a, vector unsigned short *b) +{ + return (vector unsigned short)__builtin_altivec_lvx(a, b); +} + +static vector unsigned short __ATTRS_o_ai +vec_ld(int a, unsigned short *b) +{ + return (vector unsigned short)__builtin_altivec_lvx(a, b); +} + +static vector int __ATTRS_o_ai +vec_ld(int a, vector int *b) +{ + return (vector int)__builtin_altivec_lvx(a, b); +} + +static vector int __ATTRS_o_ai +vec_ld(int a, int *b) +{ + return (vector int)__builtin_altivec_lvx(a, b); +} + +static vector unsigned int __ATTRS_o_ai +vec_ld(int a, vector unsigned int *b) +{ + return (vector unsigned int)__builtin_altivec_lvx(a, b); +} + +static vector unsigned int __ATTRS_o_ai +vec_ld(int a, unsigned int *b) +{ + return (vector unsigned int)__builtin_altivec_lvx(a, b); +} + +static vector float __ATTRS_o_ai +vec_ld(int a, vector float *b) +{ + return (vector float)__builtin_altivec_lvx(a, b); +} + +static vector float __ATTRS_o_ai +vec_ld(int a, float *b) +{ + return (vector float)__builtin_altivec_lvx(a, b); +} + +/* vec_lvx */ + +static vector signed char __ATTRS_o_ai +vec_lvx(int a, vector signed char *b) +{ + return (vector signed char)__builtin_altivec_lvx(a, b); +} + +static vector signed char __ATTRS_o_ai +vec_lvx(int a, signed char *b) +{ + return (vector signed char)__builtin_altivec_lvx(a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_lvx(int a, vector unsigned char *b) +{ + return (vector unsigned char)__builtin_altivec_lvx(a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_lvx(int a, unsigned char *b) +{ + return (vector unsigned char)__builtin_altivec_lvx(a, b); +} + +static vector short __ATTRS_o_ai +vec_lvx(int a, vector short *b) +{ + return (vector short)__builtin_altivec_lvx(a, b); +} + +static vector short __ATTRS_o_ai +vec_lvx(int a, short *b) +{ + return (vector short)__builtin_altivec_lvx(a, b); +} + +static vector unsigned short __ATTRS_o_ai +vec_lvx(int a, vector unsigned short *b) +{ + return (vector unsigned short)__builtin_altivec_lvx(a, b); +} + +static vector unsigned short __ATTRS_o_ai +vec_lvx(int a, unsigned short *b) +{ + return (vector unsigned short)__builtin_altivec_lvx(a, b); +} + +static vector int __ATTRS_o_ai +vec_lvx(int a, vector int *b) +{ + return (vector int)__builtin_altivec_lvx(a, b); +} + +static vector int __ATTRS_o_ai +vec_lvx(int a, int *b) +{ + return (vector int)__builtin_altivec_lvx(a, b); +} + +static vector unsigned int __ATTRS_o_ai +vec_lvx(int a, vector unsigned int *b) +{ + return (vector unsigned int)__builtin_altivec_lvx(a, b); +} + +static vector unsigned int __ATTRS_o_ai +vec_lvx(int a, unsigned int *b) +{ + return (vector unsigned int)__builtin_altivec_lvx(a, b); +} + +static vector float __ATTRS_o_ai +vec_lvx(int a, vector float *b) +{ + return (vector float)__builtin_altivec_lvx(a, b); +} + +static vector float __ATTRS_o_ai +vec_lvx(int a, float *b) +{ + return (vector float)__builtin_altivec_lvx(a, b); +} + +/* vec_lde */ + +static vector signed char __ATTRS_o_ai +vec_lde(int a, vector signed char *b) +{ + return (vector signed char)__builtin_altivec_lvebx(a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_lde(int a, vector unsigned char *b) +{ + return (vector unsigned char)__builtin_altivec_lvebx(a, b); +} + +static vector short __ATTRS_o_ai +vec_lde(int a, vector short *b) +{ + return (vector short)__builtin_altivec_lvehx(a, b); +} + +static vector unsigned short __ATTRS_o_ai +vec_lde(int a, vector unsigned short *b) +{ + return (vector unsigned short)__builtin_altivec_lvehx(a, b); +} + +static vector int __ATTRS_o_ai +vec_lde(int a, vector int *b) +{ + return (vector int)__builtin_altivec_lvewx(a, b); +} + +static vector unsigned int __ATTRS_o_ai +vec_lde(int a, vector unsigned int *b) +{ + return (vector unsigned int)__builtin_altivec_lvewx(a, b); +} + +static vector float __ATTRS_o_ai +vec_lde(int a, vector float *b) +{ + return (vector float)__builtin_altivec_lvewx(a, b); +} + +/* vec_lvebx */ + +static vector signed char __ATTRS_o_ai +vec_lvebx(int a, vector signed char *b) +{ + return (vector signed char)__builtin_altivec_lvebx(a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_lvebx(int a, vector unsigned char *b) +{ + return (vector unsigned char)__builtin_altivec_lvebx(a, b); +} + +/* vec_lvehx */ + +static vector short __ATTRS_o_ai +vec_lvehx(int a, vector short *b) +{ + return (vector short)__builtin_altivec_lvehx(a, b); +} + +static vector unsigned short __ATTRS_o_ai +vec_lvehx(int a, vector unsigned short *b) +{ + return (vector unsigned short)__builtin_altivec_lvehx(a, b); +} + +/* vec_lvewx */ + +static vector int __ATTRS_o_ai +vec_lvewx(int a, vector int *b) +{ + return (vector int)__builtin_altivec_lvewx(a, b); +} + +static vector unsigned int __ATTRS_o_ai +vec_lvewx(int a, vector unsigned int *b) +{ + return (vector unsigned int)__builtin_altivec_lvewx(a, b); +} + +static vector float __ATTRS_o_ai +vec_lvewx(int a, vector float *b) +{ + return (vector float)__builtin_altivec_lvewx(a, b); +} + +/* vec_ldl */ + +static vector signed char __ATTRS_o_ai +vec_ldl(int a, vector signed char *b) +{ + return (vector signed char)__builtin_altivec_lvxl(a, b); +} + +static vector signed char __ATTRS_o_ai +vec_ldl(int a, signed char *b) +{ + return (vector signed char)__builtin_altivec_lvxl(a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_ldl(int a, vector unsigned char *b) +{ + return (vector unsigned char)__builtin_altivec_lvxl(a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_ldl(int a, unsigned char *b) +{ + return (vector unsigned char)__builtin_altivec_lvxl(a, b); +} + +static vector short __ATTRS_o_ai +vec_ldl(int a, vector short *b) +{ + return (vector short)__builtin_altivec_lvxl(a, b); +} + +static vector short __ATTRS_o_ai +vec_ldl(int a, short *b) +{ + return (vector short)__builtin_altivec_lvxl(a, b); +} + +static vector unsigned short __ATTRS_o_ai +vec_ldl(int a, vector unsigned short *b) +{ + return (vector unsigned short)__builtin_altivec_lvxl(a, b); +} + +static vector unsigned short __ATTRS_o_ai +vec_ldl(int a, unsigned short *b) +{ + return (vector unsigned short)__builtin_altivec_lvxl(a, b); +} + +static vector int __ATTRS_o_ai +vec_ldl(int a, vector int *b) +{ + return (vector int)__builtin_altivec_lvxl(a, b); +} + +static vector int __ATTRS_o_ai +vec_ldl(int a, int *b) +{ + return (vector int)__builtin_altivec_lvxl(a, b); +} + +static vector unsigned int __ATTRS_o_ai +vec_ldl(int a, vector unsigned int *b) +{ + return (vector unsigned int)__builtin_altivec_lvxl(a, b); +} + +static vector unsigned int __ATTRS_o_ai +vec_ldl(int a, unsigned int *b) +{ + return (vector unsigned int)__builtin_altivec_lvxl(a, b); +} + +static vector float __ATTRS_o_ai +vec_ldl(int a, vector float *b) +{ + return (vector float)__builtin_altivec_lvxl(a, b); +} + +static vector float __ATTRS_o_ai +vec_ldl(int a, float *b) +{ + return (vector float)__builtin_altivec_lvxl(a, b); +} + +/* vec_lvxl */ + +static vector signed char __ATTRS_o_ai +vec_lvxl(int a, vector signed char *b) +{ + return (vector signed char)__builtin_altivec_lvxl(a, b); +} + +static vector signed char __ATTRS_o_ai +vec_lvxl(int a, signed char *b) +{ + return (vector signed char)__builtin_altivec_lvxl(a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_lvxl(int a, vector unsigned char *b) +{ + return (vector unsigned char)__builtin_altivec_lvxl(a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_lvxl(int a, unsigned char *b) +{ + return (vector unsigned char)__builtin_altivec_lvxl(a, b); +} + +static vector short __ATTRS_o_ai +vec_lvxl(int a, vector short *b) +{ + return (vector short)__builtin_altivec_lvxl(a, b); +} + +static vector short __ATTRS_o_ai +vec_lvxl(int a, short *b) +{ + return (vector short)__builtin_altivec_lvxl(a, b); +} + +static vector unsigned short __ATTRS_o_ai +vec_lvxl(int a, vector unsigned short *b) +{ + return (vector unsigned short)__builtin_altivec_lvxl(a, b); +} + +static vector unsigned short __ATTRS_o_ai +vec_lvxl(int a, unsigned short *b) +{ + return (vector unsigned short)__builtin_altivec_lvxl(a, b); +} + +static vector int __ATTRS_o_ai +vec_lvxl(int a, vector int *b) +{ + return (vector int)__builtin_altivec_lvxl(a, b); +} + +static vector int __ATTRS_o_ai +vec_lvxl(int a, int *b) +{ + return (vector int)__builtin_altivec_lvxl(a, b); +} + +static vector unsigned int __ATTRS_o_ai +vec_lvxl(int a, vector unsigned int *b) +{ + return (vector unsigned int)__builtin_altivec_lvxl(a, b); +} + +static vector unsigned int __ATTRS_o_ai +vec_lvxl(int a, unsigned int *b) +{ + return (vector unsigned int)__builtin_altivec_lvxl(a, b); +} + +static vector float __ATTRS_o_ai +vec_lvxl(int a, vector float *b) +{ + return (vector float)__builtin_altivec_lvxl(a, b); +} + +static vector float __ATTRS_o_ai +vec_lvxl(int a, float *b) +{ + return (vector float)__builtin_altivec_lvxl(a, b); +} + +/* vec_loge */ + +static vector float __attribute__((__always_inline__)) +vec_loge(vector float a) +{ + return __builtin_altivec_vlogefp(a); +} + +/* vec_vlogefp */ + +static vector float __attribute__((__always_inline__)) +vec_vlogefp(vector float a) +{ + return __builtin_altivec_vlogefp(a); +} + +/* vec_lvsl */ + +static vector unsigned char __ATTRS_o_ai +vec_lvsl(int a, signed char *b) +{ + return (vector unsigned char)__builtin_altivec_lvsl(a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_lvsl(int a, unsigned char *b) +{ + return (vector unsigned char)__builtin_altivec_lvsl(a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_lvsl(int a, short *b) +{ + return (vector unsigned char)__builtin_altivec_lvsl(a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_lvsl(int a, unsigned short *b) +{ + return (vector unsigned char)__builtin_altivec_lvsl(a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_lvsl(int a, int *b) +{ + return (vector unsigned char)__builtin_altivec_lvsl(a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_lvsl(int a, unsigned int *b) +{ + return (vector unsigned char)__builtin_altivec_lvsl(a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_lvsl(int a, float *b) +{ + return (vector unsigned char)__builtin_altivec_lvsl(a, b); +} + +/* vec_lvsr */ + +static vector unsigned char __ATTRS_o_ai +vec_lvsr(int a, signed char *b) +{ + return (vector unsigned char)__builtin_altivec_lvsr(a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_lvsr(int a, unsigned char *b) +{ + return (vector unsigned char)__builtin_altivec_lvsr(a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_lvsr(int a, short *b) +{ + return (vector unsigned char)__builtin_altivec_lvsr(a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_lvsr(int a, unsigned short *b) +{ + return (vector unsigned char)__builtin_altivec_lvsr(a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_lvsr(int a, int *b) +{ + return (vector unsigned char)__builtin_altivec_lvsr(a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_lvsr(int a, unsigned int *b) +{ + return (vector unsigned char)__builtin_altivec_lvsr(a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_lvsr(int a, float *b) +{ + return (vector unsigned char)__builtin_altivec_lvsr(a, b); +} + +/* vec_madd */ + +static vector float __attribute__((__always_inline__)) +vec_madd(vector float a, vector float b, vector float c) +{ + return __builtin_altivec_vmaddfp(a, b, c); +} + +/* vec_vmaddfp */ + +static vector float __attribute__((__always_inline__)) +vec_vmaddfp(vector float a, vector float b, vector float c) +{ + return __builtin_altivec_vmaddfp(a, b, c); +} + +/* vec_madds */ + +static vector signed short __attribute__((__always_inline__)) +vec_madds(vector signed short a, vector signed short b, vector signed short c) +{ + return __builtin_altivec_vmhaddshs(a, b, c); +} + +/* vec_vmhaddshs */ +static vector signed short __attribute__((__always_inline__)) +vec_vmhaddshs(vector signed short a, vector signed short b, vector signed short c) +{ + return __builtin_altivec_vmhaddshs(a, b, c); +} + /* vec_max */ -#define __builtin_vec_vmaxsb __builtin_altivec_vmaxsb -#define __builtin_vec_vmaxub __builtin_altivec_vmaxub -#define __builtin_vec_vmaxsh __builtin_altivec_vmaxsh -#define __builtin_vec_vmaxuh __builtin_altivec_vmaxuh -#define __builtin_vec_vmaxsw __builtin_altivec_vmaxsw -#define __builtin_vec_vmaxuw __builtin_altivec_vmaxuw -#define __builtin_vec_vmaxfp __builtin_altivec_vmaxfp -#define vec_vmaxsb __builtin_altivec_vmaxsb -#define vec_vmaxub __builtin_altivec_vmaxub -#define vec_vmaxsh __builtin_altivec_vmaxsh -#define vec_vmaxuh __builtin_altivec_vmaxuh -#define vec_vmaxsw __builtin_altivec_vmaxsw -#define vec_vmaxuw __builtin_altivec_vmaxuw -#define vec_vmaxfp __builtin_altivec_vmaxfp -#define __builtin_vec_max vec_max - -static vector signed char _ATTRS_o_ai +static vector signed char __ATTRS_o_ai vec_max(vector signed char a, vector signed char b) { return __builtin_altivec_vmaxsb(a, b); } -static vector unsigned char _ATTRS_o_ai +static vector unsigned char __ATTRS_o_ai vec_max(vector unsigned char a, vector unsigned char b) { return __builtin_altivec_vmaxub(a, b); } -static vector short _ATTRS_o_ai +static vector short __ATTRS_o_ai vec_max(vector short a, vector short b) { return __builtin_altivec_vmaxsh(a, b); } -static vector unsigned short _ATTRS_o_ai +static vector unsigned short __ATTRS_o_ai vec_max(vector unsigned short a, vector unsigned short b) { return __builtin_altivec_vmaxuh(a, b); } -static vector int _ATTRS_o_ai +static vector int __ATTRS_o_ai vec_max(vector int a, vector int b) { return __builtin_altivec_vmaxsw(a, b); } -static vector unsigned int _ATTRS_o_ai +static vector unsigned int __ATTRS_o_ai vec_max(vector unsigned int a, vector unsigned int b) { return __builtin_altivec_vmaxuw(a, b); } -static vector float _ATTRS_o_ai +static vector float __ATTRS_o_ai vec_max(vector float a, vector float b) { return __builtin_altivec_vmaxfp(a, b); } +/* vec_vmaxsb */ + +static vector signed char __attribute__((__always_inline__)) +vec_vmaxsb(vector signed char a, vector signed char b) +{ + return __builtin_altivec_vmaxsb(a, b); +} + +/* vec_vmaxub */ + +static vector unsigned char __attribute__((__always_inline__)) +vec_vmaxub(vector unsigned char a, vector unsigned char b) +{ + return __builtin_altivec_vmaxub(a, b); +} + +/* vec_vmaxsh */ + +static vector short __attribute__((__always_inline__)) +vec_vmaxsh(vector short a, vector short b) +{ + return __builtin_altivec_vmaxsh(a, b); +} + +/* vec_vmaxuh */ + +static vector unsigned short __attribute__((__always_inline__)) +vec_vmaxuh(vector unsigned short a, vector unsigned short b) +{ + return __builtin_altivec_vmaxuh(a, b); +} + +/* vec_vmaxsw */ + +static vector int __attribute__((__always_inline__)) +vec_vmaxsw(vector int a, vector int b) +{ + return __builtin_altivec_vmaxsw(a, b); +} + +/* vec_vmaxuw */ + +static vector unsigned int __attribute__((__always_inline__)) +vec_vmaxuw(vector unsigned int a, vector unsigned int b) +{ + return __builtin_altivec_vmaxuw(a, b); +} + +/* vec_vmaxfp */ + +static vector float __attribute__((__always_inline__)) +vec_vmaxfp(vector float a, vector float b) +{ + return __builtin_altivec_vmaxfp(a, b); +} + +/* vec_mergeh */ + +static vector signed char __ATTRS_o_ai +vec_mergeh(vector signed char a, vector signed char b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13, + 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17)); +} + +static vector unsigned char __ATTRS_o_ai +vec_mergeh(vector unsigned char a, vector unsigned char b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13, + 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17)); +} + +static vector short __ATTRS_o_ai +vec_mergeh(vector short a, vector short b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13, + 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17)); +} + +static vector unsigned short __ATTRS_o_ai +vec_mergeh(vector unsigned short a, vector unsigned short b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13, + 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17)); +} + +static vector int __ATTRS_o_ai +vec_mergeh(vector int a, vector int b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, + 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17)); +} + +static vector unsigned int __ATTRS_o_ai +vec_mergeh(vector unsigned int a, vector unsigned int b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, + 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17)); +} + +static vector float __ATTRS_o_ai +vec_mergeh(vector float a, vector float b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, + 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17)); +} + +/* vec_vmrghb */ + +#define __builtin_altivec_vmrghb vec_vmrghb + +static vector signed char __ATTRS_o_ai +vec_vmrghb(vector signed char a, vector signed char b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13, + 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17)); +} + +static vector unsigned char __ATTRS_o_ai +vec_vmrghb(vector unsigned char a, vector unsigned char b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13, + 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17)); +} + +/* vec_vmrghh */ + +#define __builtin_altivec_vmrghh vec_vmrghh + +static vector short __ATTRS_o_ai +vec_vmrghh(vector short a, vector short b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13, + 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17)); +} + +static vector unsigned short __ATTRS_o_ai +vec_vmrghh(vector unsigned short a, vector unsigned short b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13, + 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17)); +} + +/* vec_vmrghw */ + +#define __builtin_altivec_vmrghw vec_vmrghw + +static vector int __ATTRS_o_ai +vec_vmrghw(vector int a, vector int b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, + 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17)); +} + +static vector unsigned int __ATTRS_o_ai +vec_vmrghw(vector unsigned int a, vector unsigned int b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, + 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17)); +} + +static vector float __ATTRS_o_ai +vec_vmrghw(vector float a, vector float b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, + 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17)); +} + +/* vec_mergel */ + +static vector signed char __ATTRS_o_ai +vec_mergel(vector signed char a, vector signed char b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B, + 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F)); +} + +static vector unsigned char __ATTRS_o_ai +vec_mergel(vector unsigned char a, vector unsigned char b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B, + 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F)); +} + +static vector short __ATTRS_o_ai +vec_mergel(vector short a, vector short b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B, + 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F)); +} + +static vector unsigned short __ATTRS_o_ai +vec_mergel(vector unsigned short a, vector unsigned short b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B, + 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F)); +} + +static vector int __ATTRS_o_ai +vec_mergel(vector int a, vector int b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B, + 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F)); +} + +static vector unsigned int __ATTRS_o_ai +vec_mergel(vector unsigned int a, vector unsigned int b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B, + 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F)); +} + +static vector float __ATTRS_o_ai +vec_mergel(vector float a, vector float b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B, + 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F)); +} + +/* vec_vmrglb */ + +#define __builtin_altivec_vmrglb vec_vmrglb + +static vector signed char __ATTRS_o_ai +vec_vmrglb(vector signed char a, vector signed char b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B, + 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F)); +} + +static vector unsigned char __ATTRS_o_ai +vec_vmrglb(vector unsigned char a, vector unsigned char b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B, + 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F)); +} + +/* vec_vmrglh */ + +#define __builtin_altivec_vmrglh vec_vmrglh + +static vector short __ATTRS_o_ai +vec_vmrglh(vector short a, vector short b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B, + 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F)); +} + +static vector unsigned short __ATTRS_o_ai +vec_vmrglh(vector unsigned short a, vector unsigned short b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B, + 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F)); +} + +/* vec_vmrglw */ + +#define __builtin_altivec_vmrglw vec_vmrglw + +static vector int __ATTRS_o_ai +vec_vmrglw(vector int a, vector int b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B, + 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F)); +} + +static vector unsigned int __ATTRS_o_ai +vec_vmrglw(vector unsigned int a, vector unsigned int b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B, + 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F)); +} + +static vector float __ATTRS_o_ai +vec_vmrglw(vector float a, vector float b) +{ + return vec_perm(a, b, (vector unsigned char) + (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B, + 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F)); +} + /* vec_mfvscr */ -#define __builtin_vec_mfvscr __builtin_altivec_mfvscr -#define vec_mfvscr __builtin_altivec_mfvscr +static vector unsigned short __attribute__((__always_inline__)) +vec_mfvscr(void) +{ + return __builtin_altivec_mfvscr(); +} /* vec_min */ -#define __builtin_vec_vminsb __builtin_altivec_vminsb -#define __builtin_vec_vminub __builtin_altivec_vminub -#define __builtin_vec_vminsh __builtin_altivec_vminsh -#define __builtin_vec_vminuh __builtin_altivec_vminuh -#define __builtin_vec_vminsw __builtin_altivec_vminsw -#define __builtin_vec_vminuw __builtin_altivec_vminuw -#define __builtin_vec_vminfp __builtin_altivec_vminfp -#define vec_vminsb __builtin_altivec_vminsb -#define vec_vminub __builtin_altivec_vminub -#define vec_vminsh __builtin_altivec_vminsh -#define vec_vminuh __builtin_altivec_vminuh -#define vec_vminsw __builtin_altivec_vminsw -#define vec_vminuw __builtin_altivec_vminuw -#define vec_vminfp __builtin_altivec_vminfp -#define __builtin_vec_min vec_min - -static vector signed char _ATTRS_o_ai +static vector signed char __ATTRS_o_ai vec_min(vector signed char a, vector signed char b) { return __builtin_altivec_vminsb(a, b); } -static vector unsigned char _ATTRS_o_ai +static vector unsigned char __ATTRS_o_ai vec_min(vector unsigned char a, vector unsigned char b) { return __builtin_altivec_vminub(a, b); } -static vector short _ATTRS_o_ai +static vector short __ATTRS_o_ai vec_min(vector short a, vector short b) { return __builtin_altivec_vminsh(a, b); } -static vector unsigned short _ATTRS_o_ai +static vector unsigned short __ATTRS_o_ai vec_min(vector unsigned short a, vector unsigned short b) { return __builtin_altivec_vminuh(a, b); } -static vector int _ATTRS_o_ai +static vector int __ATTRS_o_ai vec_min(vector int a, vector int b) { return __builtin_altivec_vminsw(a, b); } -static vector unsigned int _ATTRS_o_ai +static vector unsigned int __ATTRS_o_ai vec_min(vector unsigned int a, vector unsigned int b) { return __builtin_altivec_vminuw(a, b); } -static vector float _ATTRS_o_ai +static vector float __ATTRS_o_ai vec_min(vector float a, vector float b) { return __builtin_altivec_vminfp(a, b); } +/* vec_vminsb */ + +static vector signed char __attribute__((__always_inline__)) +vec_vminsb(vector signed char a, vector signed char b) +{ + return __builtin_altivec_vminsb(a, b); +} + +/* vec_vminub */ + +static vector unsigned char __attribute__((__always_inline__)) +vec_vminub(vector unsigned char a, vector unsigned char b) +{ + return __builtin_altivec_vminub(a, b); +} + +/* vec_vminsh */ + +static vector short __attribute__((__always_inline__)) +vec_vminsh(vector short a, vector short b) +{ + return __builtin_altivec_vminsh(a, b); +} + +/* vec_vminuh */ + +static vector unsigned short __attribute__((__always_inline__)) +vec_vminuh(vector unsigned short a, vector unsigned short b) +{ + return __builtin_altivec_vminuh(a, b); +} + +/* vec_vminsw */ + +static vector int __attribute__((__always_inline__)) +vec_vminsw(vector int a, vector int b) +{ + return __builtin_altivec_vminsw(a, b); +} + +/* vec_vminuw */ + +static vector unsigned int __attribute__((__always_inline__)) +vec_vminuw(vector unsigned int a, vector unsigned int b) +{ + return __builtin_altivec_vminuw(a, b); +} + +/* vec_vminfp */ + +static vector float __attribute__((__always_inline__)) +vec_vminfp(vector float a, vector float b) +{ + return __builtin_altivec_vminfp(a, b); +} + +/* vec_mladd */ + +#define __builtin_altivec_vmladduhm vec_mladd + +static vector short __ATTRS_o_ai +vec_mladd(vector short a, vector short b, vector short c) +{ + return a * b + c; +} + +static vector short __ATTRS_o_ai +vec_mladd(vector short a, vector unsigned short b, vector unsigned short c) +{ + return a * (vector short)b + (vector short)c; +} + +static vector short __ATTRS_o_ai +vec_mladd(vector unsigned short a, vector short b, vector short c) +{ + return (vector short)a * b + c; +} + +static vector unsigned short __ATTRS_o_ai +vec_mladd(vector unsigned short a, vector unsigned short b, vector unsigned short c) +{ + return a * b + c; +} + +/* vec_vmladduhm */ + +static vector short __ATTRS_o_ai +vec_vmladduhm(vector short a, vector short b, vector short c) +{ + return a * b + c; +} + +static vector short __ATTRS_o_ai +vec_vmladduhm(vector short a, vector unsigned short b, vector unsigned short c) +{ + return a * (vector short)b + (vector short)c; +} + +static vector short __ATTRS_o_ai +vec_vmladduhm(vector unsigned short a, vector short b, vector short c) +{ + return (vector short)a * b + c; +} + +static vector unsigned short __ATTRS_o_ai +vec_vmladduhm(vector unsigned short a, vector unsigned short b, vector unsigned short c) +{ + return a * b + c; +} + +/* vec_mradds */ + +static vector short __attribute__((__always_inline__)) +vec_mradds(vector short a, vector short b, vector short c) +{ + return __builtin_altivec_vmhraddshs(a, b, c); +} + +/* vec_vmhraddshs */ + +static vector short __attribute__((__always_inline__)) +vec_vmhraddshs(vector short a, vector short b, vector short c) +{ + return __builtin_altivec_vmhraddshs(a, b, c); +} + +/* vec_msum */ + +static vector int __ATTRS_o_ai +vec_msum(vector signed char a, vector unsigned char b, vector int c) +{ + return __builtin_altivec_vmsummbm(a, b, c); +} + +static vector unsigned int __ATTRS_o_ai +vec_msum(vector unsigned char a, vector unsigned char b, vector unsigned int c) +{ + return __builtin_altivec_vmsumubm(a, b, c); +} + +static vector int __ATTRS_o_ai +vec_msum(vector short a, vector short b, vector int c) +{ + return __builtin_altivec_vmsumshm(a, b, c); +} + +static vector unsigned int __ATTRS_o_ai +vec_msum(vector unsigned short a, vector unsigned short b, vector unsigned int c) +{ + return __builtin_altivec_vmsumuhm(a, b, c); +} + +/* vec_vmsummbm */ + +static vector int __attribute__((__always_inline__)) +vec_vmsummbm(vector signed char a, vector unsigned char b, vector int c) +{ + return __builtin_altivec_vmsummbm(a, b, c); +} + +/* vec_vmsumubm */ + +static vector unsigned int __attribute__((__always_inline__)) +vec_vmsumubm(vector unsigned char a, vector unsigned char b, vector unsigned int c) +{ + return __builtin_altivec_vmsumubm(a, b, c); +} + +/* vec_vmsumshm */ + +static vector int __attribute__((__always_inline__)) +vec_vmsumshm(vector short a, vector short b, vector int c) +{ + return __builtin_altivec_vmsumshm(a, b, c); +} + +/* vec_vmsumuhm */ + +static vector unsigned int __attribute__((__always_inline__)) +vec_vmsumuhm(vector unsigned short a, vector unsigned short b, vector unsigned int c) +{ + return __builtin_altivec_vmsumuhm(a, b, c); +} + +/* vec_msums */ + +static vector int __ATTRS_o_ai +vec_msums(vector short a, vector short b, vector int c) +{ + return __builtin_altivec_vmsumshs(a, b, c); +} + +static vector unsigned int __ATTRS_o_ai +vec_msums(vector unsigned short a, vector unsigned short b, vector unsigned int c) +{ + return __builtin_altivec_vmsumuhs(a, b, c); +} + +/* vec_vmsumshs */ + +static vector int __attribute__((__always_inline__)) +vec_vmsumshs(vector short a, vector short b, vector int c) +{ + return __builtin_altivec_vmsumshs(a, b, c); +} + +/* vec_vmsumuhs */ + +static vector unsigned int __attribute__((__always_inline__)) +vec_vmsumuhs(vector unsigned short a, vector unsigned short b, vector unsigned int c) +{ + return __builtin_altivec_vmsumuhs(a, b, c); +} + /* vec_mtvscr */ -#define __builtin_vec_mtvscr __builtin_altivec_mtvscr -#define vec_mtvscr __builtin_altivec_mtvscr +static void __ATTRS_o_ai +vec_mtvscr(vector signed char a) +{ + __builtin_altivec_mtvscr((vector int)a); +} -/* ------------------------------ predicates ------------------------------------ */ +static void __ATTRS_o_ai +vec_mtvscr(vector unsigned char a) +{ + __builtin_altivec_mtvscr((vector int)a); +} -static int __attribute__((__always_inline__)) -__builtin_vec_vcmpeq_p(char CR6_param, vector float a, vector float b) +static void __ATTRS_o_ai +vec_mtvscr(vector short a) { - return __builtin_altivec_vcmpeqfp_p(CR6_param, a, b); + __builtin_altivec_mtvscr((vector int)a); } -static int __attribute__((__always_inline__)) -__builtin_vec_vcmpge_p(char CR6_param, vector float a, vector float b) +static void __ATTRS_o_ai +vec_mtvscr(vector unsigned short a) { - return __builtin_altivec_vcmpgefp_p(CR6_param, a, b); + __builtin_altivec_mtvscr((vector int)a); } -static int __attribute__((__always_inline__)) -__builtin_vec_vcmpgt_p(char CR6_param, vector float a, vector float b) +static void __ATTRS_o_ai +vec_mtvscr(vector int a) +{ + __builtin_altivec_mtvscr((vector int)a); +} + +static void __ATTRS_o_ai +vec_mtvscr(vector unsigned int a) +{ + __builtin_altivec_mtvscr((vector int)a); +} + +static void __ATTRS_o_ai +vec_mtvscr(vector float a) +{ + __builtin_altivec_mtvscr((vector int)a); +} + +/* vec_mule */ + +static vector short __ATTRS_o_ai +vec_mule(vector signed char a, vector signed char b) +{ + return __builtin_altivec_vmulesb(a, b); +} + +static vector unsigned short __ATTRS_o_ai +vec_mule(vector unsigned char a, vector unsigned char b) +{ + return __builtin_altivec_vmuleub(a, b); +} + +static vector int __ATTRS_o_ai +vec_mule(vector short a, vector short b) +{ + return __builtin_altivec_vmulesh(a, b); +} + +static vector unsigned int __ATTRS_o_ai +vec_mule(vector unsigned short a, vector unsigned short b) +{ + return __builtin_altivec_vmuleuh(a, b); +} + +/* vec_vmulesb */ + +static vector short __attribute__((__always_inline__)) +vec_vmulesb(vector signed char a, vector signed char b) +{ + return __builtin_altivec_vmulesb(a, b); +} + +/* vec_vmuleub */ + +static vector unsigned short __attribute__((__always_inline__)) +vec_vmuleub(vector unsigned char a, vector unsigned char b) +{ + return __builtin_altivec_vmuleub(a, b); +} + +/* vec_vmulesh */ + +static vector int __attribute__((__always_inline__)) +vec_vmulesh(vector short a, vector short b) +{ + return __builtin_altivec_vmulesh(a, b); +} + +/* vec_vmuleuh */ + +static vector unsigned int __attribute__((__always_inline__)) +vec_vmuleuh(vector unsigned short a, vector unsigned short b) +{ + return __builtin_altivec_vmuleuh(a, b); +} + +/* vec_mulo */ + +static vector short __ATTRS_o_ai +vec_mulo(vector signed char a, vector signed char b) +{ + return __builtin_altivec_vmulosb(a, b); +} + +static vector unsigned short __ATTRS_o_ai +vec_mulo(vector unsigned char a, vector unsigned char b) +{ + return __builtin_altivec_vmuloub(a, b); +} + +static vector int __ATTRS_o_ai +vec_mulo(vector short a, vector short b) +{ + return __builtin_altivec_vmulosh(a, b); +} + +static vector unsigned int __ATTRS_o_ai +vec_mulo(vector unsigned short a, vector unsigned short b) +{ + return __builtin_altivec_vmulouh(a, b); +} + +/* vec_vmulosb */ + +static vector short __attribute__((__always_inline__)) +vec_vmulosb(vector signed char a, vector signed char b) +{ + return __builtin_altivec_vmulosb(a, b); +} + +/* vec_vmuloub */ + +static vector unsigned short __attribute__((__always_inline__)) +vec_vmuloub(vector unsigned char a, vector unsigned char b) +{ + return __builtin_altivec_vmuloub(a, b); +} + +/* vec_vmulosh */ + +static vector int __attribute__((__always_inline__)) +vec_vmulosh(vector short a, vector short b) +{ + return __builtin_altivec_vmulosh(a, b); +} + +/* vec_vmulouh */ + +static vector unsigned int __attribute__((__always_inline__)) +vec_vmulouh(vector unsigned short a, vector unsigned short b) +{ + return __builtin_altivec_vmulouh(a, b); +} + +/* vec_nmsub */ + +static vector float __attribute__((__always_inline__)) +vec_nmsub(vector float a, vector float b, vector float c) +{ + return __builtin_altivec_vnmsubfp(a, b, c); +} + +/* vec_vnmsubfp */ + +static vector float __attribute__((__always_inline__)) +vec_vnmsubfp(vector float a, vector float b, vector float c) +{ + return __builtin_altivec_vnmsubfp(a, b, c); +} + +/* vec_nor */ + +#define __builtin_altivec_vnor vec_nor + +static vector signed char __ATTRS_o_ai +vec_nor(vector signed char a, vector signed char b) +{ + return ~(a | b); +} + +static vector unsigned char __ATTRS_o_ai +vec_nor(vector unsigned char a, vector unsigned char b) +{ + return ~(a | b); +} + +static vector short __ATTRS_o_ai +vec_nor(vector short a, vector short b) +{ + return ~(a | b); +} + +static vector unsigned short __ATTRS_o_ai +vec_nor(vector unsigned short a, vector unsigned short b) +{ + return ~(a | b); +} + +static vector int __ATTRS_o_ai +vec_nor(vector int a, vector int b) +{ + return ~(a | b); +} + +static vector unsigned int __ATTRS_o_ai +vec_nor(vector unsigned int a, vector unsigned int b) +{ + return ~(a | b); +} + +static vector float __ATTRS_o_ai +vec_nor(vector float a, vector float b) +{ + vector unsigned int res = ~((vector unsigned int)a | (vector unsigned int)b); + return (vector float)res; +} + +/* vec_vnor */ + +static vector signed char __ATTRS_o_ai +vec_vnor(vector signed char a, vector signed char b) +{ + return ~(a | b); +} + +static vector unsigned char __ATTRS_o_ai +vec_vnor(vector unsigned char a, vector unsigned char b) +{ + return ~(a | b); +} + +static vector short __ATTRS_o_ai +vec_vnor(vector short a, vector short b) +{ + return ~(a | b); +} + +static vector unsigned short __ATTRS_o_ai +vec_vnor(vector unsigned short a, vector unsigned short b) +{ + return ~(a | b); +} + +static vector int __ATTRS_o_ai +vec_vnor(vector int a, vector int b) +{ + return ~(a | b); +} + +static vector unsigned int __ATTRS_o_ai +vec_vnor(vector unsigned int a, vector unsigned int b) +{ + return ~(a | b); +} + +static vector float __ATTRS_o_ai +vec_vnor(vector float a, vector float b) +{ + vector unsigned int res = ~((vector unsigned int)a | (vector unsigned int)b); + return (vector float)res; +} + +/* vec_or */ + +#define __builtin_altivec_vor vec_or + +static vector signed char __ATTRS_o_ai +vec_or(vector signed char a, vector signed char b) +{ + return a | b; +} + +static vector unsigned char __ATTRS_o_ai +vec_or(vector unsigned char a, vector unsigned char b) +{ + return a | b; +} + +static vector short __ATTRS_o_ai +vec_or(vector short a, vector short b) +{ + return a | b; +} + +static vector unsigned short __ATTRS_o_ai +vec_or(vector unsigned short a, vector unsigned short b) +{ + return a | b; +} + +static vector int __ATTRS_o_ai +vec_or(vector int a, vector int b) +{ + return a | b; +} + +static vector unsigned int __ATTRS_o_ai +vec_or(vector unsigned int a, vector unsigned int b) +{ + return a | b; +} + +static vector float __ATTRS_o_ai +vec_or(vector float a, vector float b) +{ + vector unsigned int res = (vector unsigned int)a | (vector unsigned int)b; + return (vector float)res; +} + +/* vec_vor */ + +static vector signed char __ATTRS_o_ai +vec_vor(vector signed char a, vector signed char b) +{ + return a | b; +} + +static vector unsigned char __ATTRS_o_ai +vec_vor(vector unsigned char a, vector unsigned char b) +{ + return a | b; +} + +static vector short __ATTRS_o_ai +vec_vor(vector short a, vector short b) +{ + return a | b; +} + +static vector unsigned short __ATTRS_o_ai +vec_vor(vector unsigned short a, vector unsigned short b) +{ + return a | b; +} + +static vector int __ATTRS_o_ai +vec_vor(vector int a, vector int b) +{ + return a | b; +} + +static vector unsigned int __ATTRS_o_ai +vec_vor(vector unsigned int a, vector unsigned int b) +{ + return a | b; +} + +static vector float __ATTRS_o_ai +vec_vor(vector float a, vector float b) +{ + vector unsigned int res = (vector unsigned int)a | (vector unsigned int)b; + return (vector float)res; +} + +/* vec_pack */ + +static vector signed char __ATTRS_o_ai +vec_pack(vector signed short a, vector signed short b) +{ + return (vector signed char)vec_perm(a, b, (vector unsigned char) + (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, + 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); +} + +static vector unsigned char __ATTRS_o_ai +vec_pack(vector unsigned short a, vector unsigned short b) +{ + return (vector unsigned char)vec_perm(a, b, (vector unsigned char) + (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, + 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); +} + +static vector short __ATTRS_o_ai +vec_pack(vector int a, vector int b) +{ + return (vector short)vec_perm(a, b, (vector unsigned char) + (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, + 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); +} + +static vector unsigned short __ATTRS_o_ai +vec_pack(vector unsigned int a, vector unsigned int b) +{ + return (vector unsigned short)vec_perm(a, b, (vector unsigned char) + (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, + 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); +} + +/* vec_vpkuhum */ + +#define __builtin_altivec_vpkuhum vec_vpkuhum + +static vector signed char __ATTRS_o_ai +vec_vpkuhum(vector signed short a, vector signed short b) +{ + return (vector signed char)vec_perm(a, b, (vector unsigned char) + (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, + 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); +} + +static vector unsigned char __ATTRS_o_ai +vec_vpkuhum(vector unsigned short a, vector unsigned short b) +{ + return (vector unsigned char)vec_perm(a, b, (vector unsigned char) + (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, + 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); +} + +/* vec_vpkuwum */ + +#define __builtin_altivec_vpkuwum vec_vpkuwum + +static vector short __ATTRS_o_ai +vec_vpkuwum(vector int a, vector int b) +{ + return (vector short)vec_perm(a, b, (vector unsigned char) + (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, + 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); +} + +static vector unsigned short __ATTRS_o_ai +vec_vpkuwum(vector unsigned int a, vector unsigned int b) +{ + return (vector unsigned short)vec_perm(a, b, (vector unsigned char) + (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, + 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); +} + +/* vec_packpx */ + +static vector pixel __attribute__((__always_inline__)) +vec_packpx(vector unsigned int a, vector unsigned int b) +{ + return (vector pixel)__builtin_altivec_vpkpx(a, b); +} + +/* vec_vpkpx */ + +static vector pixel __attribute__((__always_inline__)) +vec_vpkpx(vector unsigned int a, vector unsigned int b) +{ + return (vector pixel)__builtin_altivec_vpkpx(a, b); +} + +/* vec_packs */ + +static vector signed char __ATTRS_o_ai +vec_packs(vector short a, vector short b) +{ + return __builtin_altivec_vpkshss(a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_packs(vector unsigned short a, vector unsigned short b) +{ + return __builtin_altivec_vpkuhus(a, b); +} + +static vector signed short __ATTRS_o_ai +vec_packs(vector int a, vector int b) +{ + return __builtin_altivec_vpkswss(a, b); +} + +static vector unsigned short __ATTRS_o_ai +vec_packs(vector unsigned int a, vector unsigned int b) +{ + return __builtin_altivec_vpkuwus(a, b); +} + +/* vec_vpkshss */ + +static vector signed char __attribute__((__always_inline__)) +vec_vpkshss(vector short a, vector short b) +{ + return __builtin_altivec_vpkshss(a, b); +} + +/* vec_vpkuhus */ + +static vector unsigned char __attribute__((__always_inline__)) +vec_vpkuhus(vector unsigned short a, vector unsigned short b) +{ + return __builtin_altivec_vpkuhus(a, b); +} + +/* vec_vpkswss */ + +static vector signed short __attribute__((__always_inline__)) +vec_vpkswss(vector int a, vector int b) +{ + return __builtin_altivec_vpkswss(a, b); +} + +/* vec_vpkuwus */ + +static vector unsigned short __attribute__((__always_inline__)) +vec_vpkuwus(vector unsigned int a, vector unsigned int b) +{ + return __builtin_altivec_vpkuwus(a, b); +} + +/* vec_packsu */ + +static vector unsigned char __ATTRS_o_ai +vec_packsu(vector short a, vector short b) +{ + return __builtin_altivec_vpkshus(a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_packsu(vector unsigned short a, vector unsigned short b) +{ + return __builtin_altivec_vpkuhus(a, b); +} + +static vector unsigned short __ATTRS_o_ai +vec_packsu(vector int a, vector int b) +{ + return __builtin_altivec_vpkswus(a, b); +} + +static vector unsigned short __ATTRS_o_ai +vec_packsu(vector unsigned int a, vector unsigned int b) +{ + return __builtin_altivec_vpkuwus(a, b); +} + +/* vec_vpkshus */ + +static vector unsigned char __ATTRS_o_ai +vec_vpkshus(vector short a, vector short b) +{ + return __builtin_altivec_vpkshus(a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_vpkshus(vector unsigned short a, vector unsigned short b) +{ + return __builtin_altivec_vpkuhus(a, b); +} + +/* vec_vpkswus */ + +static vector unsigned short __ATTRS_o_ai +vec_vpkswus(vector int a, vector int b) +{ + return __builtin_altivec_vpkswus(a, b); +} + +static vector unsigned short __ATTRS_o_ai +vec_vpkswus(vector unsigned int a, vector unsigned int b) +{ + return __builtin_altivec_vpkuwus(a, b); +} + +/* vec_perm */ + +vector signed char __ATTRS_o_ai +vec_perm(vector signed char a, vector signed char b, vector unsigned char c) +{ + return (vector signed char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); +} + +vector unsigned char __ATTRS_o_ai +vec_perm(vector unsigned char a, vector unsigned char b, vector unsigned char c) +{ + return (vector unsigned char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); +} + +vector short __ATTRS_o_ai +vec_perm(vector short a, vector short b, vector unsigned char c) +{ + return (vector short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); +} + +vector unsigned short __ATTRS_o_ai +vec_perm(vector unsigned short a, vector unsigned short b, vector unsigned char c) +{ + return (vector unsigned short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); +} + +vector int __ATTRS_o_ai +vec_perm(vector int a, vector int b, vector unsigned char c) +{ + return (vector int)__builtin_altivec_vperm_4si(a, b, c); +} + +vector unsigned int __ATTRS_o_ai +vec_perm(vector unsigned int a, vector unsigned int b, vector unsigned char c) +{ + return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); +} + +vector float __ATTRS_o_ai +vec_perm(vector float a, vector float b, vector unsigned char c) +{ + return (vector float)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); +} + +/* vec_vperm */ + +vector signed char __ATTRS_o_ai +vec_vperm(vector signed char a, vector signed char b, vector unsigned char c) +{ + return (vector signed char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); +} + +vector unsigned char __ATTRS_o_ai +vec_vperm(vector unsigned char a, vector unsigned char b, vector unsigned char c) +{ + return (vector unsigned char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); +} + +vector short __ATTRS_o_ai +vec_vperm(vector short a, vector short b, vector unsigned char c) +{ + return (vector short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); +} + +vector unsigned short __ATTRS_o_ai +vec_vperm(vector unsigned short a, vector unsigned short b, vector unsigned char c) +{ + return (vector unsigned short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); +} + +vector int __ATTRS_o_ai +vec_vperm(vector int a, vector int b, vector unsigned char c) +{ + return (vector int)__builtin_altivec_vperm_4si(a, b, c); +} + +vector unsigned int __ATTRS_o_ai +vec_vperm(vector unsigned int a, vector unsigned int b, vector unsigned char c) +{ + return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); +} + +vector float __ATTRS_o_ai +vec_vperm(vector float a, vector float b, vector unsigned char c) +{ + return (vector float)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); +} + +/* vec_re */ + +vector float __attribute__((__always_inline__)) +vec_re(vector float a) +{ + return __builtin_altivec_vrefp(a); +} + +/* vec_vrefp */ + +vector float __attribute__((__always_inline__)) +vec_vrefp(vector float a) +{ + return __builtin_altivec_vrefp(a); +} + +/* vec_rl */ + +static vector signed char __ATTRS_o_ai +vec_rl(vector signed char a, vector unsigned char b) +{ + return (vector signed char)__builtin_altivec_vrlb((vector char)a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_rl(vector unsigned char a, vector unsigned char b) +{ + return (vector unsigned char)__builtin_altivec_vrlb((vector char)a, b); +} + +static vector short __ATTRS_o_ai +vec_rl(vector short a, vector unsigned short b) +{ + return __builtin_altivec_vrlh(a, b); +} + +static vector unsigned short __ATTRS_o_ai +vec_rl(vector unsigned short a, vector unsigned short b) +{ + return (vector unsigned short)__builtin_altivec_vrlh((vector short)a, b); +} + +static vector int __ATTRS_o_ai +vec_rl(vector int a, vector unsigned int b) +{ + return __builtin_altivec_vrlw(a, b); +} + +static vector unsigned int __ATTRS_o_ai +vec_rl(vector unsigned int a, vector unsigned int b) +{ + return (vector unsigned int)__builtin_altivec_vrlw((vector int)a, b); +} + +/* vec_vrlb */ + +static vector signed char __ATTRS_o_ai +vec_vrlb(vector signed char a, vector unsigned char b) +{ + return (vector signed char)__builtin_altivec_vrlb((vector char)a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_vrlb(vector unsigned char a, vector unsigned char b) +{ + return (vector unsigned char)__builtin_altivec_vrlb((vector char)a, b); +} + +/* vec_vrlh */ + +static vector short __ATTRS_o_ai +vec_vrlh(vector short a, vector unsigned short b) +{ + return __builtin_altivec_vrlh(a, b); +} + +static vector unsigned short __ATTRS_o_ai +vec_vrlh(vector unsigned short a, vector unsigned short b) +{ + return (vector unsigned short)__builtin_altivec_vrlh((vector short)a, b); +} + +/* vec_vrlw */ + +static vector int __ATTRS_o_ai +vec_vrlw(vector int a, vector unsigned int b) +{ + return __builtin_altivec_vrlw(a, b); +} + +static vector unsigned int __ATTRS_o_ai +vec_vrlw(vector unsigned int a, vector unsigned int b) +{ + return (vector unsigned int)__builtin_altivec_vrlw((vector int)a, b); +} + +/* vec_round */ + +static vector float __attribute__((__always_inline__)) +vec_round(vector float a) +{ + return __builtin_altivec_vrfin(a); +} + +/* vec_vrfin */ + +static vector float __attribute__((__always_inline__)) +vec_vrfin(vector float a) +{ + return __builtin_altivec_vrfin(a); +} + +/* vec_rsqrte */ + +static __vector float __attribute__((__always_inline__)) +vec_rsqrte(vector float a) +{ + return __builtin_altivec_vrsqrtefp(a); +} + +/* vec_vrsqrtefp */ + +static __vector float __attribute__((__always_inline__)) +vec_vrsqrtefp(vector float a) +{ + return __builtin_altivec_vrsqrtefp(a); +} + +/* vec_sel */ + +#define __builtin_altivec_vsel_4si vec_sel + +static vector signed char __ATTRS_o_ai +vec_sel(vector signed char a, vector signed char b, vector unsigned char c) +{ + return (a & ~(vector signed char)c) | (b & (vector signed char)c); +} + +static vector unsigned char __ATTRS_o_ai +vec_sel(vector unsigned char a, vector unsigned char b, vector unsigned char c) +{ + return (a & ~c) | (b & c); +} + +static vector short __ATTRS_o_ai +vec_sel(vector short a, vector short b, vector unsigned short c) +{ + return (a & ~(vector short)c) | (b & (vector short)c); +} + +static vector unsigned short __ATTRS_o_ai +vec_sel(vector unsigned short a, vector unsigned short b, vector unsigned short c) +{ + return (a & ~c) | (b & c); +} + +static vector int __ATTRS_o_ai +vec_sel(vector int a, vector int b, vector unsigned int c) +{ + return (a & ~(vector int)c) | (b & (vector int)c); +} + +static vector unsigned int __ATTRS_o_ai +vec_sel(vector unsigned int a, vector unsigned int b, vector unsigned int c) +{ + return (a & ~c) | (b & c); +} + +static vector float __ATTRS_o_ai +vec_sel(vector float a, vector float b, vector unsigned int c) +{ + vector int res = ((vector int)a & ~(vector int)c) | ((vector int)b & (vector int)c); + return (vector float)res; +} + +/* vec_vsel */ + +static vector signed char __ATTRS_o_ai +vec_vsel(vector signed char a, vector signed char b, vector unsigned char c) +{ + return (a & ~(vector signed char)c) | (b & (vector signed char)c); +} + +static vector unsigned char __ATTRS_o_ai +vec_vsel(vector unsigned char a, vector unsigned char b, vector unsigned char c) +{ + return (a & ~c) | (b & c); +} + +static vector short __ATTRS_o_ai +vec_vsel(vector short a, vector short b, vector unsigned short c) +{ + return (a & ~(vector short)c) | (b & (vector short)c); +} + +static vector unsigned short __ATTRS_o_ai +vec_vsel(vector unsigned short a, vector unsigned short b, vector unsigned short c) +{ + return (a & ~c) | (b & c); +} + +static vector int __ATTRS_o_ai +vec_vsel(vector int a, vector int b, vector unsigned int c) +{ + return (a & ~(vector int)c) | (b & (vector int)c); +} + +static vector unsigned int __ATTRS_o_ai +vec_vsel(vector unsigned int a, vector unsigned int b, vector unsigned int c) +{ + return (a & ~c) | (b & c); +} + +static vector float __ATTRS_o_ai +vec_vsel(vector float a, vector float b, vector unsigned int c) +{ + vector int res = ((vector int)a & ~(vector int)c) | ((vector int)b & (vector int)c); + return (vector float)res; +} + +/* vec_sl */ + +static vector signed char __ATTRS_o_ai +vec_sl(vector signed char a, vector unsigned char b) +{ + return a << (vector signed char)b; +} + +static vector unsigned char __ATTRS_o_ai +vec_sl(vector unsigned char a, vector unsigned char b) +{ + return a << b; +} + +static vector short __ATTRS_o_ai +vec_sl(vector short a, vector unsigned short b) +{ + return a << (vector short)b; +} + +static vector unsigned short __ATTRS_o_ai +vec_sl(vector unsigned short a, vector unsigned short b) +{ + return a << b; +} + +static vector int __ATTRS_o_ai +vec_sl(vector int a, vector unsigned int b) +{ + return a << (vector int)b; +} + +static vector unsigned int __ATTRS_o_ai +vec_sl(vector unsigned int a, vector unsigned int b) +{ + return a << b; +} + +/* vec_vslb */ + +#define __builtin_altivec_vslb vec_vslb + +static vector signed char __ATTRS_o_ai +vec_vslb(vector signed char a, vector unsigned char b) +{ + return vec_sl(a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_vslb(vector unsigned char a, vector unsigned char b) +{ + return vec_sl(a, b); +} + +/* vec_vslh */ + +#define __builtin_altivec_vslh vec_vslh + +static vector short __ATTRS_o_ai +vec_vslh(vector short a, vector unsigned short b) +{ + return vec_sl(a, b); +} + +static vector unsigned short __ATTRS_o_ai +vec_vslh(vector unsigned short a, vector unsigned short b) +{ + return vec_sl(a, b); +} + +/* vec_vslw */ + +#define __builtin_altivec_vslw vec_vslw + +static vector int __ATTRS_o_ai +vec_vslw(vector int a, vector unsigned int b) +{ + return vec_sl(a, b); +} + +static vector unsigned int __ATTRS_o_ai +vec_vslw(vector unsigned int a, vector unsigned int b) +{ + return vec_sl(a, b); +} + +/* vec_sld */ + +#define __builtin_altivec_vsldoi_4si vec_sld + +static vector signed char __ATTRS_o_ai +vec_sld(vector signed char a, vector signed char b, unsigned char c) +{ + return (vector signed char)vec_perm(a, b, (vector unsigned char) + (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, + c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); +} + +static vector unsigned char __ATTRS_o_ai +vec_sld(vector unsigned char a, vector unsigned char b, unsigned char c) +{ + return (vector unsigned char)vec_perm(a, b, (vector unsigned char) + (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, + c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); +} + +static vector short __ATTRS_o_ai +vec_sld(vector short a, vector short b, unsigned char c) +{ + return (vector short)vec_perm(a, b, (vector unsigned char) + (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, + c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); +} + +static vector unsigned short __ATTRS_o_ai +vec_sld(vector unsigned short a, vector unsigned short b, unsigned char c) +{ + return (vector unsigned short)vec_perm(a, b, (vector unsigned char) + (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, + c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); +} + +static vector int __ATTRS_o_ai +vec_sld(vector int a, vector int b, unsigned char c) +{ + return vec_perm(a, b, (vector unsigned char) + (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, + c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); +} + +static vector unsigned int __ATTRS_o_ai +vec_sld(vector unsigned int a, vector unsigned int b, unsigned char c) +{ + return (vector unsigned int)vec_perm(a, b, (vector unsigned char) + (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, + c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); +} + +static vector float __ATTRS_o_ai +vec_sld(vector float a, vector float b, unsigned char c) +{ + return (vector float)vec_perm(a, b, (vector unsigned char) + (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, + c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); +} + +/* vec_vsldoi */ + +static vector signed char __ATTRS_o_ai +vec_vsldoi(vector signed char a, vector signed char b, unsigned char c) +{ + return (vector signed char)vec_perm(a, b, (vector unsigned char) + (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, + c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); +} + +static vector unsigned char __ATTRS_o_ai +vec_vsldoi(vector unsigned char a, vector unsigned char b, unsigned char c) +{ + return (vector unsigned char)vec_perm(a, b, (vector unsigned char) + (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, + c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); +} + +static vector short __ATTRS_o_ai +vec_vsldoi(vector short a, vector short b, unsigned char c) +{ + return (vector short)vec_perm(a, b, (vector unsigned char) + (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, + c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); +} + +static vector unsigned short __ATTRS_o_ai +vec_vsldoi(vector unsigned short a, vector unsigned short b, unsigned char c) +{ + return (vector unsigned short)vec_perm(a, b, (vector unsigned char) + (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, + c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); +} + +static vector int __ATTRS_o_ai +vec_vsldoi(vector int a, vector int b, unsigned char c) +{ + return vec_perm(a, b, (vector unsigned char) + (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, + c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); +} + +static vector unsigned int __ATTRS_o_ai +vec_vsldoi(vector unsigned int a, vector unsigned int b, unsigned char c) +{ + return (vector unsigned int)vec_perm(a, b, (vector unsigned char) + (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, + c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); +} + +static vector float __ATTRS_o_ai +vec_vsldoi(vector float a, vector float b, unsigned char c) +{ + return (vector float)vec_perm(a, b, (vector unsigned char) + (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, + c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); +} + +/* vec_sll */ + +static vector signed char __ATTRS_o_ai +vec_sll(vector signed char a, vector unsigned char b) +{ + return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector signed char __ATTRS_o_ai +vec_sll(vector signed char a, vector unsigned short b) +{ + return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector signed char __ATTRS_o_ai +vec_sll(vector signed char a, vector unsigned int b) +{ + return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector unsigned char __ATTRS_o_ai +vec_sll(vector unsigned char a, vector unsigned char b) +{ + return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector unsigned char __ATTRS_o_ai +vec_sll(vector unsigned char a, vector unsigned short b) +{ + return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector unsigned char __ATTRS_o_ai +vec_sll(vector unsigned char a, vector unsigned int b) +{ + return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector short __ATTRS_o_ai +vec_sll(vector short a, vector unsigned char b) +{ + return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector short __ATTRS_o_ai +vec_sll(vector short a, vector unsigned short b) +{ + return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector short __ATTRS_o_ai +vec_sll(vector short a, vector unsigned int b) +{ + return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector unsigned short __ATTRS_o_ai +vec_sll(vector unsigned short a, vector unsigned char b) +{ + return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector unsigned short __ATTRS_o_ai +vec_sll(vector unsigned short a, vector unsigned short b) +{ + return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector unsigned short __ATTRS_o_ai +vec_sll(vector unsigned short a, vector unsigned int b) +{ + return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector int __ATTRS_o_ai +vec_sll(vector int a, vector unsigned char b) +{ + return (vector int)__builtin_altivec_vsl(a, (vector int)b); +} + +static vector int __ATTRS_o_ai +vec_sll(vector int a, vector unsigned short b) +{ + return (vector int)__builtin_altivec_vsl(a, (vector int)b); +} + +static vector int __ATTRS_o_ai +vec_sll(vector int a, vector unsigned int b) +{ + return (vector int)__builtin_altivec_vsl(a, (vector int)b); +} + +static vector unsigned int __ATTRS_o_ai +vec_sll(vector unsigned int a, vector unsigned char b) +{ + return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector unsigned int __ATTRS_o_ai +vec_sll(vector unsigned int a, vector unsigned short b) +{ + return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector unsigned int __ATTRS_o_ai +vec_sll(vector unsigned int a, vector unsigned int b) +{ + return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +/* vec_vsl */ + +static vector signed char __ATTRS_o_ai +vec_vsl(vector signed char a, vector unsigned char b) +{ + return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector signed char __ATTRS_o_ai +vec_vsl(vector signed char a, vector unsigned short b) +{ + return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector signed char __ATTRS_o_ai +vec_vsl(vector signed char a, vector unsigned int b) +{ + return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector unsigned char __ATTRS_o_ai +vec_vsl(vector unsigned char a, vector unsigned char b) +{ + return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector unsigned char __ATTRS_o_ai +vec_vsl(vector unsigned char a, vector unsigned short b) +{ + return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector unsigned char __ATTRS_o_ai +vec_vsl(vector unsigned char a, vector unsigned int b) +{ + return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector short __ATTRS_o_ai +vec_vsl(vector short a, vector unsigned char b) +{ + return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector short __ATTRS_o_ai +vec_vsl(vector short a, vector unsigned short b) +{ + return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector short __ATTRS_o_ai +vec_vsl(vector short a, vector unsigned int b) +{ + return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector unsigned short __ATTRS_o_ai +vec_vsl(vector unsigned short a, vector unsigned char b) +{ + return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector unsigned short __ATTRS_o_ai +vec_vsl(vector unsigned short a, vector unsigned short b) +{ + return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector unsigned short __ATTRS_o_ai +vec_vsl(vector unsigned short a, vector unsigned int b) +{ + return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector int __ATTRS_o_ai +vec_vsl(vector int a, vector unsigned char b) +{ + return (vector int)__builtin_altivec_vsl(a, (vector int)b); +} + +static vector int __ATTRS_o_ai +vec_vsl(vector int a, vector unsigned short b) +{ + return (vector int)__builtin_altivec_vsl(a, (vector int)b); +} + +static vector int __ATTRS_o_ai +vec_vsl(vector int a, vector unsigned int b) +{ + return (vector int)__builtin_altivec_vsl(a, (vector int)b); +} + +static vector unsigned int __ATTRS_o_ai +vec_vsl(vector unsigned int a, vector unsigned char b) +{ + return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector unsigned int __ATTRS_o_ai +vec_vsl(vector unsigned int a, vector unsigned short b) +{ + return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +static vector unsigned int __ATTRS_o_ai +vec_vsl(vector unsigned int a, vector unsigned int b) +{ + return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b); +} + +/* vec_slo */ + +static vector signed char __ATTRS_o_ai +vec_slo(vector signed char a, vector signed char b) +{ + return (vector signed char)__builtin_altivec_vslo((vector int)a, (vector int)b); +} + +static vector signed char __ATTRS_o_ai +vec_slo(vector signed char a, vector unsigned char b) +{ + return (vector signed char)__builtin_altivec_vslo((vector int)a, (vector int)b); +} + +static vector unsigned char __ATTRS_o_ai +vec_slo(vector unsigned char a, vector signed char b) +{ + return (vector unsigned char)__builtin_altivec_vslo((vector int)a, (vector int)b); +} + +static vector unsigned char __ATTRS_o_ai +vec_slo(vector unsigned char a, vector unsigned char b) +{ + return (vector unsigned char)__builtin_altivec_vslo((vector int)a, (vector int)b); +} + +static vector short __ATTRS_o_ai +vec_slo(vector short a, vector signed char b) +{ + return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b); +} + +static vector short __ATTRS_o_ai +vec_slo(vector short a, vector unsigned char b) +{ + return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b); +} + +static vector unsigned short __ATTRS_o_ai +vec_slo(vector unsigned short a, vector signed char b) +{ + return (vector unsigned short)__builtin_altivec_vslo((vector int)a, (vector int)b); +} + +static vector unsigned short __ATTRS_o_ai +vec_slo(vector unsigned short a, vector unsigned char b) +{ + return (vector unsigned short)__builtin_altivec_vslo((vector int)a, (vector int)b); +} + +static vector int __ATTRS_o_ai +vec_slo(vector int a, vector signed char b) +{ + return (vector int)__builtin_altivec_vslo(a, (vector int)b); +} + +static vector int __ATTRS_o_ai +vec_slo(vector int a, vector unsigned char b) +{ + return (vector int)__builtin_altivec_vslo(a, (vector int)b); +} + +static vector unsigned int __ATTRS_o_ai +vec_slo(vector unsigned int a, vector signed char b) +{ + return (vector unsigned int)__builtin_altivec_vslo((vector int)a, (vector int)b); +} + +static vector unsigned int __ATTRS_o_ai +vec_slo(vector unsigned int a, vector unsigned char b) +{ + return (vector unsigned int)__builtin_altivec_vslo((vector int)a, (vector int)b); +} + +static vector float __ATTRS_o_ai +vec_slo(vector float a, vector signed char b) +{ + return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b); +} + +static vector float __ATTRS_o_ai +vec_slo(vector float a, vector unsigned char b) +{ + return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b); +} + +/* vec_vslo */ + +static vector signed char __ATTRS_o_ai +vec_vslo(vector signed char a, vector signed char b) +{ + return (vector signed char)__builtin_altivec_vslo((vector int)a, (vector int)b); +} + +static vector signed char __ATTRS_o_ai +vec_vslo(vector signed char a, vector unsigned char b) +{ + return (vector signed char)__builtin_altivec_vslo((vector int)a, (vector int)b); +} + +static vector unsigned char __ATTRS_o_ai +vec_vslo(vector unsigned char a, vector signed char b) +{ + return (vector unsigned char)__builtin_altivec_vslo((vector int)a, (vector int)b); +} + +static vector unsigned char __ATTRS_o_ai +vec_vslo(vector unsigned char a, vector unsigned char b) { - return __builtin_altivec_vcmpgtfp_p(CR6_param, a, b); + return (vector unsigned char)__builtin_altivec_vslo((vector int)a, (vector int)b); } +static vector short __ATTRS_o_ai +vec_vslo(vector short a, vector signed char b) +{ + return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b); +} + +static vector short __ATTRS_o_ai +vec_vslo(vector short a, vector unsigned char b) +{ + return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b); +} + +static vector unsigned short __ATTRS_o_ai +vec_vslo(vector unsigned short a, vector signed char b) +{ + return (vector unsigned short)__builtin_altivec_vslo((vector int)a, (vector int)b); +} + +static vector unsigned short __ATTRS_o_ai +vec_vslo(vector unsigned short a, vector unsigned char b) +{ + return (vector unsigned short)__builtin_altivec_vslo((vector int)a, (vector int)b); +} + +static vector int __ATTRS_o_ai +vec_vslo(vector int a, vector signed char b) +{ + return (vector int)__builtin_altivec_vslo(a, (vector int)b); +} + +static vector int __ATTRS_o_ai +vec_vslo(vector int a, vector unsigned char b) +{ + return (vector int)__builtin_altivec_vslo(a, (vector int)b); +} + +static vector unsigned int __ATTRS_o_ai +vec_vslo(vector unsigned int a, vector signed char b) +{ + return (vector unsigned int)__builtin_altivec_vslo((vector int)a, (vector int)b); +} + +static vector unsigned int __ATTRS_o_ai +vec_vslo(vector unsigned int a, vector unsigned char b) +{ + return (vector unsigned int)__builtin_altivec_vslo((vector int)a, (vector int)b); +} + +static vector float __ATTRS_o_ai +vec_vslo(vector float a, vector signed char b) +{ + return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b); +} + +static vector float __ATTRS_o_ai +vec_vslo(vector float a, vector unsigned char b) +{ + return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b); +} + +/* vec_splat */ + +static vector signed char __ATTRS_o_ai +vec_splat(vector signed char a, unsigned char b) +{ + return (vector signed char)vec_perm(a, a, (vector unsigned char)(b)); +} + +static vector unsigned char __ATTRS_o_ai +vec_splat(vector unsigned char a, unsigned char b) +{ + return (vector unsigned char)vec_perm(a, a, (vector unsigned char)(b)); +} + +static vector short __ATTRS_o_ai +vec_splat(vector short a, unsigned char b) +{ + b *= 2; + return (vector short)vec_perm(a, a, (vector unsigned char) + (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1)); +} + +static vector unsigned short __ATTRS_o_ai +vec_splat(vector unsigned short a, unsigned char b) +{ + b *= 2; + return (vector unsigned short)vec_perm(a, a, (vector unsigned char) + (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1)); +} + +static vector int __ATTRS_o_ai +vec_splat(vector int a, unsigned char b) +{ + b *= 4; + return vec_perm(a, a, (vector unsigned char) + (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3)); +} + +static vector unsigned int __ATTRS_o_ai +vec_splat(vector unsigned int a, unsigned char b) +{ + b *= 4; + return (vector unsigned int)vec_perm(a, a, (vector unsigned char) + (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3)); +} + +static vector float __ATTRS_o_ai +vec_splat(vector float a, unsigned char b) +{ + b *= 4; + return (vector float)vec_perm(a, a, (vector unsigned char) + (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3)); +} + +/* vec_vspltb */ + +#define __builtin_altivec_vspltb vec_vspltb + +static vector signed char __ATTRS_o_ai +vec_vspltb(vector signed char a, unsigned char b) +{ + return (vector signed char)vec_perm(a, a, (vector unsigned char)(b)); +} + +static vector unsigned char __ATTRS_o_ai +vec_vspltb(vector unsigned char a, unsigned char b) +{ + return (vector unsigned char)vec_perm(a, a, (vector unsigned char)(b)); +} + +/* vec_vsplth */ + +#define __builtin_altivec_vsplth vec_vsplth + +static vector short __ATTRS_o_ai +vec_vsplth(vector short a, unsigned char b) +{ + b *= 2; + return (vector short)vec_perm(a, a, (vector unsigned char) + (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1)); +} + +static vector unsigned short __ATTRS_o_ai +vec_vsplth(vector unsigned short a, unsigned char b) +{ + b *= 2; + return (vector unsigned short)vec_perm(a, a, (vector unsigned char) + (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1)); +} + +/* vec_vspltw */ + +#define __builtin_altivec_vspltw vec_vspltw + +static vector int __ATTRS_o_ai +vec_vspltw(vector int a, unsigned char b) +{ + b *= 4; + return (vector int)vec_perm(a, a, (vector unsigned char) + (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3)); +} + +static vector unsigned int __ATTRS_o_ai +vec_vspltw(vector unsigned int a, unsigned char b) +{ + b *= 4; + return (vector unsigned int)vec_perm(a, a, (vector unsigned char) + (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3)); +} + +static vector float __ATTRS_o_ai +vec_vspltw(vector float a, unsigned char b) +{ + b *= 4; + return (vector float)vec_perm(a, a, (vector unsigned char) + (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3)); +} + +/* vec_splat_s8 */ + +#define __builtin_altivec_vspltisb vec_splat_s8 + +// FIXME: parameter should be treated as 5-bit signed literal +static vector signed char __ATTRS_o_ai +vec_splat_s8(signed char a) +{ + return (vector signed char)(a); +} + +/* vec_vspltisb */ + +// FIXME: parameter should be treated as 5-bit signed literal +static vector signed char __ATTRS_o_ai +vec_vspltisb(signed char a) +{ + return (vector signed char)(a); +} + +/* vec_splat_s16 */ + +#define __builtin_altivec_vspltish vec_splat_s16 + +// FIXME: parameter should be treated as 5-bit signed literal +static vector short __ATTRS_o_ai +vec_splat_s16(signed char a) +{ + return (vector short)(a); +} + +/* vec_vspltish */ + +// FIXME: parameter should be treated as 5-bit signed literal +static vector short __ATTRS_o_ai +vec_vspltish(signed char a) +{ + return (vector short)(a); +} + +/* vec_splat_s32 */ + +#define __builtin_altivec_vspltisw vec_splat_s32 + +// FIXME: parameter should be treated as 5-bit signed literal +static vector int __ATTRS_o_ai +vec_splat_s32(signed char a) +{ + return (vector int)(a); +} + +/* vec_vspltisw */ + +// FIXME: parameter should be treated as 5-bit signed literal +static vector int __ATTRS_o_ai +vec_vspltisw(signed char a) +{ + return (vector int)(a); +} + +/* vec_splat_u8 */ + +// FIXME: parameter should be treated as 5-bit signed literal +static vector unsigned char __ATTRS_o_ai +vec_splat_u8(unsigned char a) +{ + return (vector unsigned char)(a); +} + +/* vec_splat_u16 */ + +// FIXME: parameter should be treated as 5-bit signed literal +static vector unsigned short __ATTRS_o_ai +vec_splat_u16(signed char a) +{ + return (vector unsigned short)(a); +} + +/* vec_splat_u32 */ + +// FIXME: parameter should be treated as 5-bit signed literal +static vector unsigned int __ATTRS_o_ai +vec_splat_u32(signed char a) +{ + return (vector unsigned int)(a); +} + +/* vec_sr */ + +static vector signed char __ATTRS_o_ai +vec_sr(vector signed char a, vector unsigned char b) +{ + return a >> (vector signed char)b; +} + +static vector unsigned char __ATTRS_o_ai +vec_sr(vector unsigned char a, vector unsigned char b) +{ + return a >> b; +} + +static vector short __ATTRS_o_ai +vec_sr(vector short a, vector unsigned short b) +{ + return a >> (vector short)b; +} + +static vector unsigned short __ATTRS_o_ai +vec_sr(vector unsigned short a, vector unsigned short b) +{ + return a >> b; +} + +static vector int __ATTRS_o_ai +vec_sr(vector int a, vector unsigned int b) +{ + return a >> (vector int)b; +} + +static vector unsigned int __ATTRS_o_ai +vec_sr(vector unsigned int a, vector unsigned int b) +{ + return a >> b; +} + +/* vec_vsrb */ + +#define __builtin_altivec_vsrb vec_vsrb + +static vector signed char __ATTRS_o_ai +vec_vsrb(vector signed char a, vector unsigned char b) +{ + return a >> (vector signed char)b; +} + +static vector unsigned char __ATTRS_o_ai +vec_vsrb(vector unsigned char a, vector unsigned char b) +{ + return a >> b; +} + +/* vec_vsrh */ + +#define __builtin_altivec_vsrh vec_vsrh + +static vector short __ATTRS_o_ai +vec_vsrh(vector short a, vector unsigned short b) +{ + return a >> (vector short)b; +} + +static vector unsigned short __ATTRS_o_ai +vec_vsrh(vector unsigned short a, vector unsigned short b) +{ + return a >> b; +} + +/* vec_vsrw */ + +#define __builtin_altivec_vsrw vec_vsrw + +static vector int __ATTRS_o_ai +vec_vsrw(vector int a, vector unsigned int b) +{ + return a >> (vector int)b; +} + +static vector unsigned int __ATTRS_o_ai +vec_vsrw(vector unsigned int a, vector unsigned int b) +{ + return a >> b; +} + +/* vec_sra */ + +static vector signed char __ATTRS_o_ai +vec_sra(vector signed char a, vector unsigned char b) +{ + return (vector signed char)__builtin_altivec_vsrab((vector char)a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_sra(vector unsigned char a, vector unsigned char b) +{ + return (vector unsigned char)__builtin_altivec_vsrab((vector char)a, b); +} + +static vector short __ATTRS_o_ai +vec_sra(vector short a, vector unsigned short b) +{ + return __builtin_altivec_vsrah(a, (vector unsigned short)b); +} + +static vector unsigned short __ATTRS_o_ai +vec_sra(vector unsigned short a, vector unsigned short b) +{ + return (vector unsigned short)__builtin_altivec_vsrah((vector short)a, b); +} + +static vector int __ATTRS_o_ai +vec_sra(vector int a, vector unsigned int b) +{ + return __builtin_altivec_vsraw(a, b); +} + +static vector unsigned int __ATTRS_o_ai +vec_sra(vector unsigned int a, vector unsigned int b) +{ + return (vector unsigned int)__builtin_altivec_vsraw((vector int)a, b); +} + +/* vec_vsrab */ + +static vector signed char __ATTRS_o_ai +vec_vsrab(vector signed char a, vector unsigned char b) +{ + return (vector signed char)__builtin_altivec_vsrab((vector char)a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_vsrab(vector unsigned char a, vector unsigned char b) +{ + return (vector unsigned char)__builtin_altivec_vsrab((vector char)a, b); +} + +/* vec_vsrah */ + +static vector short __ATTRS_o_ai +vec_vsrah(vector short a, vector unsigned short b) +{ + return __builtin_altivec_vsrah(a, (vector unsigned short)b); +} + +static vector unsigned short __ATTRS_o_ai +vec_vsrah(vector unsigned short a, vector unsigned short b) +{ + return (vector unsigned short)__builtin_altivec_vsrah((vector short)a, b); +} + +/* vec_vsraw */ + +static vector int __ATTRS_o_ai +vec_vsraw(vector int a, vector unsigned int b) +{ + return __builtin_altivec_vsraw(a, b); +} + +static vector unsigned int __ATTRS_o_ai +vec_vsraw(vector unsigned int a, vector unsigned int b) +{ + return (vector unsigned int)__builtin_altivec_vsraw((vector int)a, b); +} + +/* vec_srl */ + +static vector signed char __ATTRS_o_ai +vec_srl(vector signed char a, vector unsigned char b) +{ + return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector signed char __ATTRS_o_ai +vec_srl(vector signed char a, vector unsigned short b) +{ + return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector signed char __ATTRS_o_ai +vec_srl(vector signed char a, vector unsigned int b) +{ + return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector unsigned char __ATTRS_o_ai +vec_srl(vector unsigned char a, vector unsigned char b) +{ + return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector unsigned char __ATTRS_o_ai +vec_srl(vector unsigned char a, vector unsigned short b) +{ + return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector unsigned char __ATTRS_o_ai +vec_srl(vector unsigned char a, vector unsigned int b) +{ + return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector short __ATTRS_o_ai +vec_srl(vector short a, vector unsigned char b) +{ + return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector short __ATTRS_o_ai +vec_srl(vector short a, vector unsigned short b) +{ + return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector short __ATTRS_o_ai +vec_srl(vector short a, vector unsigned int b) +{ + return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector unsigned short __ATTRS_o_ai +vec_srl(vector unsigned short a, vector unsigned char b) +{ + return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector unsigned short __ATTRS_o_ai +vec_srl(vector unsigned short a, vector unsigned short b) +{ + return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector unsigned short __ATTRS_o_ai +vec_srl(vector unsigned short a, vector unsigned int b) +{ + return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector int __ATTRS_o_ai +vec_srl(vector int a, vector unsigned char b) +{ + return (vector int)__builtin_altivec_vsr(a, (vector int)b); +} + +static vector int __ATTRS_o_ai +vec_srl(vector int a, vector unsigned short b) +{ + return (vector int)__builtin_altivec_vsr(a, (vector int)b); +} + +static vector int __ATTRS_o_ai +vec_srl(vector int a, vector unsigned int b) +{ + return (vector int)__builtin_altivec_vsr(a, (vector int)b); +} + +static vector unsigned int __ATTRS_o_ai +vec_srl(vector unsigned int a, vector unsigned char b) +{ + return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector unsigned int __ATTRS_o_ai +vec_srl(vector unsigned int a, vector unsigned short b) +{ + return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector unsigned int __ATTRS_o_ai +vec_srl(vector unsigned int a, vector unsigned int b) +{ + return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +/* vec_vsr */ + +static vector signed char __ATTRS_o_ai +vec_vsr(vector signed char a, vector unsigned char b) +{ + return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector signed char __ATTRS_o_ai +vec_vsr(vector signed char a, vector unsigned short b) +{ + return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector signed char __ATTRS_o_ai +vec_vsr(vector signed char a, vector unsigned int b) +{ + return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector unsigned char __ATTRS_o_ai +vec_vsr(vector unsigned char a, vector unsigned char b) +{ + return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector unsigned char __ATTRS_o_ai +vec_vsr(vector unsigned char a, vector unsigned short b) +{ + return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector unsigned char __ATTRS_o_ai +vec_vsr(vector unsigned char a, vector unsigned int b) +{ + return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector short __ATTRS_o_ai +vec_vsr(vector short a, vector unsigned char b) +{ + return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector short __ATTRS_o_ai +vec_vsr(vector short a, vector unsigned short b) +{ + return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector short __ATTRS_o_ai +vec_vsr(vector short a, vector unsigned int b) +{ + return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector unsigned short __ATTRS_o_ai +vec_vsr(vector unsigned short a, vector unsigned char b) +{ + return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector unsigned short __ATTRS_o_ai +vec_vsr(vector unsigned short a, vector unsigned short b) +{ + return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector unsigned short __ATTRS_o_ai +vec_vsr(vector unsigned short a, vector unsigned int b) +{ + return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector int __ATTRS_o_ai +vec_vsr(vector int a, vector unsigned char b) +{ + return (vector int)__builtin_altivec_vsr(a, (vector int)b); +} + +static vector int __ATTRS_o_ai +vec_vsr(vector int a, vector unsigned short b) +{ + return (vector int)__builtin_altivec_vsr(a, (vector int)b); +} + +static vector int __ATTRS_o_ai +vec_vsr(vector int a, vector unsigned int b) +{ + return (vector int)__builtin_altivec_vsr(a, (vector int)b); +} + +static vector unsigned int __ATTRS_o_ai +vec_vsr(vector unsigned int a, vector unsigned char b) +{ + return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector unsigned int __ATTRS_o_ai +vec_vsr(vector unsigned int a, vector unsigned short b) +{ + return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +static vector unsigned int __ATTRS_o_ai +vec_vsr(vector unsigned int a, vector unsigned int b) +{ + return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b); +} + +/* vec_sro */ + +static vector signed char __ATTRS_o_ai +vec_sro(vector signed char a, vector signed char b) +{ + return (vector signed char)__builtin_altivec_vsro((vector int)a, (vector int)b); +} + +static vector signed char __ATTRS_o_ai +vec_sro(vector signed char a, vector unsigned char b) +{ + return (vector signed char)__builtin_altivec_vsro((vector int)a, (vector int)b); +} + +static vector unsigned char __ATTRS_o_ai +vec_sro(vector unsigned char a, vector signed char b) +{ + return (vector unsigned char)__builtin_altivec_vsro((vector int)a, (vector int)b); +} + +static vector unsigned char __ATTRS_o_ai +vec_sro(vector unsigned char a, vector unsigned char b) +{ + return (vector unsigned char)__builtin_altivec_vsro((vector int)a, (vector int)b); +} + +static vector short __ATTRS_o_ai +vec_sro(vector short a, vector signed char b) +{ + return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b); +} + +static vector short __ATTRS_o_ai +vec_sro(vector short a, vector unsigned char b) +{ + return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b); +} + +static vector unsigned short __ATTRS_o_ai +vec_sro(vector unsigned short a, vector signed char b) +{ + return (vector unsigned short)__builtin_altivec_vsro((vector int)a, (vector int)b); +} + +static vector unsigned short __ATTRS_o_ai +vec_sro(vector unsigned short a, vector unsigned char b) +{ + return (vector unsigned short)__builtin_altivec_vsro((vector int)a, (vector int)b); +} + +static vector int __ATTRS_o_ai +vec_sro(vector int a, vector signed char b) +{ + return (vector int)__builtin_altivec_vsro(a, (vector int)b); +} + +static vector int __ATTRS_o_ai +vec_sro(vector int a, vector unsigned char b) +{ + return (vector int)__builtin_altivec_vsro(a, (vector int)b); +} + +static vector unsigned int __ATTRS_o_ai +vec_sro(vector unsigned int a, vector signed char b) +{ + return (vector unsigned int)__builtin_altivec_vsro((vector int)a, (vector int)b); +} + +static vector unsigned int __ATTRS_o_ai +vec_sro(vector unsigned int a, vector unsigned char b) +{ + return (vector unsigned int)__builtin_altivec_vsro((vector int)a, (vector int)b); +} + +static vector float __ATTRS_o_ai +vec_sro(vector float a, vector signed char b) +{ + return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b); +} + +static vector float __ATTRS_o_ai +vec_sro(vector float a, vector unsigned char b) +{ + return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b); +} + +/* vec_vsro */ + +static vector signed char __ATTRS_o_ai +vec_vsro(vector signed char a, vector signed char b) +{ + return (vector signed char)__builtin_altivec_vsro((vector int)a, (vector int)b); +} + +static vector signed char __ATTRS_o_ai +vec_vsro(vector signed char a, vector unsigned char b) +{ + return (vector signed char)__builtin_altivec_vsro((vector int)a, (vector int)b); +} + +static vector unsigned char __ATTRS_o_ai +vec_vsro(vector unsigned char a, vector signed char b) +{ + return (vector unsigned char)__builtin_altivec_vsro((vector int)a, (vector int)b); +} + +static vector unsigned char __ATTRS_o_ai +vec_vsro(vector unsigned char a, vector unsigned char b) +{ + return (vector unsigned char)__builtin_altivec_vsro((vector int)a, (vector int)b); +} + +static vector short __ATTRS_o_ai +vec_vsro(vector short a, vector signed char b) +{ + return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b); +} + +static vector short __ATTRS_o_ai +vec_vsro(vector short a, vector unsigned char b) +{ + return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b); +} + +static vector unsigned short __ATTRS_o_ai +vec_vsro(vector unsigned short a, vector signed char b) +{ + return (vector unsigned short)__builtin_altivec_vsro((vector int)a, (vector int)b); +} + +static vector unsigned short __ATTRS_o_ai +vec_vsro(vector unsigned short a, vector unsigned char b) +{ + return (vector unsigned short)__builtin_altivec_vsro((vector int)a, (vector int)b); +} + +static vector int __ATTRS_o_ai +vec_vsro(vector int a, vector signed char b) +{ + return (vector int)__builtin_altivec_vsro(a, (vector int)b); +} + +static vector int __ATTRS_o_ai +vec_vsro(vector int a, vector unsigned char b) +{ + return (vector int)__builtin_altivec_vsro(a, (vector int)b); +} + +static vector unsigned int __ATTRS_o_ai +vec_vsro(vector unsigned int a, vector signed char b) +{ + return (vector unsigned int)__builtin_altivec_vsro((vector int)a, (vector int)b); +} + +static vector unsigned int __ATTRS_o_ai +vec_vsro(vector unsigned int a, vector unsigned char b) +{ + return (vector unsigned int)__builtin_altivec_vsro((vector int)a, (vector int)b); +} + +static vector float __ATTRS_o_ai +vec_vsro(vector float a, vector signed char b) +{ + return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b); +} + +static vector float __ATTRS_o_ai +vec_vsro(vector float a, vector unsigned char b) +{ + return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b); +} + +/* vec_st */ + +static void __ATTRS_o_ai +vec_st(vector signed char a, int b, vector signed char *c) +{ + __builtin_altivec_stvx((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_st(vector signed char a, int b, signed char *c) +{ + __builtin_altivec_stvx((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_st(vector unsigned char a, int b, vector unsigned char *c) +{ + __builtin_altivec_stvx((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_st(vector unsigned char a, int b, unsigned char *c) +{ + __builtin_altivec_stvx((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_st(vector short a, int b, vector short *c) +{ + __builtin_altivec_stvx((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_st(vector short a, int b, short *c) +{ + __builtin_altivec_stvx((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_st(vector unsigned short a, int b, vector unsigned short *c) +{ + __builtin_altivec_stvx((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_st(vector unsigned short a, int b, unsigned short *c) +{ + __builtin_altivec_stvx((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_st(vector int a, int b, vector int *c) +{ + __builtin_altivec_stvx(a, b, c); +} + +static void __ATTRS_o_ai +vec_st(vector int a, int b, int *c) +{ + __builtin_altivec_stvx(a, b, c); +} + +static void __ATTRS_o_ai +vec_st(vector unsigned int a, int b, vector unsigned int *c) +{ + __builtin_altivec_stvx((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_st(vector unsigned int a, int b, unsigned int *c) +{ + __builtin_altivec_stvx((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_st(vector float a, int b, vector float *c) +{ + __builtin_altivec_stvx((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_st(vector float a, int b, float *c) +{ + __builtin_altivec_stvx((vector int)a, b, c); +} + +/* vec_stvx */ + +static void __ATTRS_o_ai +vec_stvx(vector signed char a, int b, vector signed char *c) +{ + __builtin_altivec_stvx((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stvx(vector signed char a, int b, signed char *c) +{ + __builtin_altivec_stvx((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stvx(vector unsigned char a, int b, vector unsigned char *c) +{ + __builtin_altivec_stvx((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stvx(vector unsigned char a, int b, unsigned char *c) +{ + __builtin_altivec_stvx((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stvx(vector short a, int b, vector short *c) +{ + __builtin_altivec_stvx((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stvx(vector short a, int b, short *c) +{ + __builtin_altivec_stvx((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stvx(vector unsigned short a, int b, vector unsigned short *c) +{ + __builtin_altivec_stvx((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stvx(vector unsigned short a, int b, unsigned short *c) +{ + __builtin_altivec_stvx((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stvx(vector int a, int b, vector int *c) +{ + __builtin_altivec_stvx(a, b, c); +} + +static void __ATTRS_o_ai +vec_stvx(vector int a, int b, int *c) +{ + __builtin_altivec_stvx(a, b, c); +} + +static void __ATTRS_o_ai +vec_stvx(vector unsigned int a, int b, vector unsigned int *c) +{ + __builtin_altivec_stvx((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stvx(vector unsigned int a, int b, unsigned int *c) +{ + __builtin_altivec_stvx((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stvx(vector float a, int b, vector float *c) +{ + __builtin_altivec_stvx((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stvx(vector float a, int b, float *c) +{ + __builtin_altivec_stvx((vector int)a, b, c); +} + +/* vec_ste */ + +static void __ATTRS_o_ai +vec_ste(vector signed char a, int b, signed char *c) +{ + __builtin_altivec_stvebx((vector char)a, b, c); +} + +static void __ATTRS_o_ai +vec_ste(vector unsigned char a, int b, unsigned char *c) +{ + __builtin_altivec_stvebx((vector char)a, b, c); +} + +static void __ATTRS_o_ai +vec_ste(vector short a, int b, short *c) +{ + __builtin_altivec_stvehx(a, b, c); +} + +static void __ATTRS_o_ai +vec_ste(vector unsigned short a, int b, unsigned short *c) +{ + __builtin_altivec_stvehx((vector short)a, b, c); +} + +static void __ATTRS_o_ai +vec_ste(vector int a, int b, int *c) +{ + __builtin_altivec_stvewx(a, b, c); +} + +static void __ATTRS_o_ai +vec_ste(vector unsigned int a, int b, unsigned int *c) +{ + __builtin_altivec_stvewx((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_ste(vector float a, int b, float *c) +{ + __builtin_altivec_stvewx((vector int)a, b, c); +} + +/* vec_stvebx */ + +static void __ATTRS_o_ai +vec_stvebx(vector signed char a, int b, signed char *c) +{ + __builtin_altivec_stvebx((vector char)a, b, c); +} + +static void __ATTRS_o_ai +vec_stvebx(vector unsigned char a, int b, unsigned char *c) +{ + __builtin_altivec_stvebx((vector char)a, b, c); +} + +/* vec_stvehx */ + +static void __ATTRS_o_ai +vec_stvehx(vector short a, int b, short *c) +{ + __builtin_altivec_stvehx(a, b, c); +} + +static void __ATTRS_o_ai +vec_stvehx(vector unsigned short a, int b, unsigned short *c) +{ + __builtin_altivec_stvehx((vector short)a, b, c); +} + +/* vec_stvewx */ + +static void __ATTRS_o_ai +vec_stvewx(vector int a, int b, int *c) +{ + __builtin_altivec_stvewx(a, b, c); +} + +static void __ATTRS_o_ai +vec_stvewx(vector unsigned int a, int b, unsigned int *c) +{ + __builtin_altivec_stvewx((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stvewx(vector float a, int b, float *c) +{ + __builtin_altivec_stvewx((vector int)a, b, c); +} + +/* vec_stl */ + +static void __ATTRS_o_ai +vec_stl(vector signed char a, int b, vector signed char *c) +{ + __builtin_altivec_stvxl((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stl(vector signed char a, int b, signed char *c) +{ + __builtin_altivec_stvxl((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stl(vector unsigned char a, int b, vector unsigned char *c) +{ + __builtin_altivec_stvxl((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stl(vector unsigned char a, int b, unsigned char *c) +{ + __builtin_altivec_stvxl((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stl(vector short a, int b, vector short *c) +{ + __builtin_altivec_stvxl((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stl(vector short a, int b, short *c) +{ + __builtin_altivec_stvxl((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stl(vector unsigned short a, int b, vector unsigned short *c) +{ + __builtin_altivec_stvxl((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stl(vector unsigned short a, int b, unsigned short *c) +{ + __builtin_altivec_stvxl((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stl(vector int a, int b, vector int *c) +{ + __builtin_altivec_stvxl(a, b, c); +} + +static void __ATTRS_o_ai +vec_stl(vector int a, int b, int *c) +{ + __builtin_altivec_stvxl(a, b, c); +} + +static void __ATTRS_o_ai +vec_stl(vector unsigned int a, int b, vector unsigned int *c) +{ + __builtin_altivec_stvxl((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stl(vector unsigned int a, int b, unsigned int *c) +{ + __builtin_altivec_stvxl((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stl(vector float a, int b, vector float *c) +{ + __builtin_altivec_stvxl((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stl(vector float a, int b, float *c) +{ + __builtin_altivec_stvxl((vector int)a, b, c); +} + +/* vec_stvxl */ + +static void __ATTRS_o_ai +vec_stvxl(vector signed char a, int b, vector signed char *c) +{ + __builtin_altivec_stvxl((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stvxl(vector signed char a, int b, signed char *c) +{ + __builtin_altivec_stvxl((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stvxl(vector unsigned char a, int b, vector unsigned char *c) +{ + __builtin_altivec_stvxl((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stvxl(vector unsigned char a, int b, unsigned char *c) +{ + __builtin_altivec_stvxl((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stvxl(vector short a, int b, vector short *c) +{ + __builtin_altivec_stvxl((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stvxl(vector short a, int b, short *c) +{ + __builtin_altivec_stvxl((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stvxl(vector unsigned short a, int b, vector unsigned short *c) +{ + __builtin_altivec_stvxl((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stvxl(vector unsigned short a, int b, unsigned short *c) +{ + __builtin_altivec_stvxl((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stvxl(vector int a, int b, vector int *c) +{ + __builtin_altivec_stvxl(a, b, c); +} + +static void __ATTRS_o_ai +vec_stvxl(vector int a, int b, int *c) +{ + __builtin_altivec_stvxl(a, b, c); +} + +static void __ATTRS_o_ai +vec_stvxl(vector unsigned int a, int b, vector unsigned int *c) +{ + __builtin_altivec_stvxl((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stvxl(vector unsigned int a, int b, unsigned int *c) +{ + __builtin_altivec_stvxl((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stvxl(vector float a, int b, vector float *c) +{ + __builtin_altivec_stvxl((vector int)a, b, c); +} + +static void __ATTRS_o_ai +vec_stvxl(vector float a, int b, float *c) +{ + __builtin_altivec_stvxl((vector int)a, b, c); +} + +/* vec_sub */ + +static vector signed char __ATTRS_o_ai +vec_sub(vector signed char a, vector signed char b) +{ + return a - b; +} + +static vector unsigned char __ATTRS_o_ai +vec_sub(vector unsigned char a, vector unsigned char b) +{ + return a - b; +} + +static vector short __ATTRS_o_ai +vec_sub(vector short a, vector short b) +{ + return a - b; +} + +static vector unsigned short __ATTRS_o_ai +vec_sub(vector unsigned short a, vector unsigned short b) +{ + return a - b; +} + +static vector int __ATTRS_o_ai +vec_sub(vector int a, vector int b) +{ + return a - b; +} + +static vector unsigned int __ATTRS_o_ai +vec_sub(vector unsigned int a, vector unsigned int b) +{ + return a - b; +} + +static vector float __ATTRS_o_ai +vec_sub(vector float a, vector float b) +{ + return a - b; +} + +/* vec_vsububm */ + +#define __builtin_altivec_vsububm vec_vsububm + +static vector signed char __ATTRS_o_ai +vec_vsububm(vector signed char a, vector signed char b) +{ + return a - b; +} + +static vector unsigned char __ATTRS_o_ai +vec_vsububm(vector unsigned char a, vector unsigned char b) +{ + return a - b; +} + +/* vec_vsubuhm */ + +#define __builtin_altivec_vsubuhm vec_vsubuhm + +static vector short __ATTRS_o_ai +vec_vsubuhm(vector short a, vector short b) +{ + return a - b; +} + +static vector unsigned short __ATTRS_o_ai +vec_vsubuhm(vector unsigned short a, vector unsigned short b) +{ + return a - b; +} + +/* vec_vsubuwm */ + +#define __builtin_altivec_vsubuwm vec_vsubuwm + +static vector int __ATTRS_o_ai +vec_vsubuwm(vector int a, vector int b) +{ + return a - b; +} + +static vector unsigned int __ATTRS_o_ai +vec_vsubuwm(vector unsigned int a, vector unsigned int b) +{ + return a - b; +} + +/* vec_vsubfp */ + +#define __builtin_altivec_vsubfp vec_vsubfp + +static vector float __attribute__((__always_inline__)) +vec_vsubfp(vector float a, vector float b) +{ + return a - b; +} + +/* vec_subc */ + +static vector unsigned int __attribute__((__always_inline__)) +vec_subc(vector unsigned int a, vector unsigned int b) +{ + return __builtin_altivec_vsubcuw(a, b); +} + +/* vec_vsubcuw */ + +static vector unsigned int __attribute__((__always_inline__)) +vec_vsubcuw(vector unsigned int a, vector unsigned int b) +{ + return __builtin_altivec_vsubcuw(a, b); +} + +/* vec_subs */ + +static vector signed char __ATTRS_o_ai +vec_subs(vector signed char a, vector signed char b) +{ + return __builtin_altivec_vsubsbs(a, b); +} + +static vector unsigned char __ATTRS_o_ai +vec_subs(vector unsigned char a, vector unsigned char b) +{ + return __builtin_altivec_vsububs(a, b); +} + +static vector short __ATTRS_o_ai +vec_subs(vector short a, vector short b) +{ + return __builtin_altivec_vsubshs(a, b); +} + +static vector unsigned short __ATTRS_o_ai +vec_subs(vector unsigned short a, vector unsigned short b) +{ + return __builtin_altivec_vsubuhs(a, b); +} + +static vector int __ATTRS_o_ai +vec_subs(vector int a, vector int b) +{ + return __builtin_altivec_vsubsws(a, b); +} + +static vector unsigned int __ATTRS_o_ai +vec_subs(vector unsigned int a, vector unsigned int b) +{ + return __builtin_altivec_vsubuws(a, b); +} + +/* vec_vsubsbs */ + +static vector signed char __attribute__((__always_inline__)) +vec_vsubsbs(vector signed char a, vector signed char b) +{ + return __builtin_altivec_vsubsbs(a, b); +} + +/* vec_vsububs */ + +static vector unsigned char __attribute__((__always_inline__)) +vec_vsububs(vector unsigned char a, vector unsigned char b) +{ + return __builtin_altivec_vsububs(a, b); +} + +/* vec_vsubshs */ + +static vector short __attribute__((__always_inline__)) +vec_vsubshs(vector short a, vector short b) +{ + return __builtin_altivec_vsubshs(a, b); +} + +/* vec_vsubuhs */ + +static vector unsigned short __attribute__((__always_inline__)) +vec_vsubuhs(vector unsigned short a, vector unsigned short b) +{ + return __builtin_altivec_vsubuhs(a, b); +} + +/* vec_vsubsws */ + +static vector int __attribute__((__always_inline__)) +vec_vsubsws(vector int a, vector int b) +{ + return __builtin_altivec_vsubsws(a, b); +} + +/* vec_vsubuws */ + +static vector unsigned int __attribute__((__always_inline__)) +vec_vsubuws(vector unsigned int a, vector unsigned int b) +{ + return __builtin_altivec_vsubuws(a, b); +} + +/* vec_sum4s */ + +static vector int __ATTRS_o_ai +vec_sum4s(vector signed char a, vector int b) +{ + return __builtin_altivec_vsum4sbs(a, b); +} + +static vector unsigned int __ATTRS_o_ai +vec_sum4s(vector unsigned char a, vector unsigned int b) +{ + return __builtin_altivec_vsum4ubs(a, b); +} + +static vector int __ATTRS_o_ai +vec_sum4s(vector signed short a, vector int b) +{ + return __builtin_altivec_vsum4shs(a, b); +} + +/* vec_vsum4sbs */ + +static vector int __attribute__((__always_inline__)) +vec_vsum4sbs(vector signed char a, vector int b) +{ + return __builtin_altivec_vsum4sbs(a, b); +} + +/* vec_vsum4ubs */ + +static vector unsigned int __attribute__((__always_inline__)) +vec_vsum4ubs(vector unsigned char a, vector unsigned int b) +{ + return __builtin_altivec_vsum4ubs(a, b); +} + +/* vec_vsum4shs */ + +static vector int __attribute__((__always_inline__)) +vec_vsum4shs(vector signed short a, vector int b) +{ + return __builtin_altivec_vsum4shs(a, b); +} + +/* vec_sum2s */ + +static vector signed int __attribute__((__always_inline__)) +vec_sum2s(vector int a, vector int b) +{ + return __builtin_altivec_vsum2sws(a, b); +} + +/* vec_vsum2sws */ + +static vector signed int __attribute__((__always_inline__)) +vec_vsum2sws(vector int a, vector int b) +{ + return __builtin_altivec_vsum2sws(a, b); +} + +/* vec_sums */ + +static vector signed int __attribute__((__always_inline__)) +vec_sums(vector signed int a, vector signed int b) +{ + return __builtin_altivec_vsumsws(a, b); +} + +/* vec_vsumsws */ + +static vector signed int __attribute__((__always_inline__)) +vec_vsumsws(vector signed int a, vector signed int b) +{ + return __builtin_altivec_vsumsws(a, b); +} + +/* vec_trunc */ + +static vector float __attribute__((__always_inline__)) +vec_trunc(vector float a) +{ + return __builtin_altivec_vrfiz(a); +} + +/* vec_vrfiz */ + +static vector float __attribute__((__always_inline__)) +vec_vrfiz(vector float a) +{ + return __builtin_altivec_vrfiz(a); +} + +/* vec_unpackh */ + +static vector short __ATTRS_o_ai +vec_unpackh(vector signed char a) +{ + return __builtin_altivec_vupkhsb((vector char)a); +} + +static vector int __ATTRS_o_ai +vec_unpackh(vector short a) +{ + return __builtin_altivec_vupkhsh(a); +} + +/* vec_vupkhsb */ + +static vector short __attribute__((__always_inline__)) +vec_vupkhsb(vector signed char a) +{ + return __builtin_altivec_vupkhsb((vector char)a); +} + +/* vec_vupkhsh */ + +static vector int __attribute__((__always_inline__)) +vec_vupkhsh(vector short a) +{ + return __builtin_altivec_vupkhsh(a); +} + +/* vec_unpackl */ + +static vector short __ATTRS_o_ai +vec_unpackl(vector signed char a) +{ + return __builtin_altivec_vupklsb((vector char)a); +} + +static vector int __ATTRS_o_ai +vec_unpackl(vector short a) +{ + return __builtin_altivec_vupklsh(a); +} + +/* vec_vupklsb */ + +static vector short __attribute__((__always_inline__)) +vec_vupklsb(vector signed char a) +{ + return __builtin_altivec_vupklsb((vector char)a); +} + +/* vec_vupklsh */ + +static vector int __attribute__((__always_inline__)) +vec_vupklsh(vector short a) +{ + return __builtin_altivec_vupklsh(a); +} + +/* vec_xor */ + +#define __builtin_altivec_vxor vec_xor + +static vector signed char __ATTRS_o_ai +vec_xor(vector signed char a, vector signed char b) +{ + return a ^ b; +} + +static vector unsigned char __ATTRS_o_ai +vec_xor(vector unsigned char a, vector unsigned char b) +{ + return a ^ b; +} + +static vector short __ATTRS_o_ai +vec_xor(vector short a, vector short b) +{ + return a ^ b; +} + +static vector unsigned short __ATTRS_o_ai +vec_xor(vector unsigned short a, vector unsigned short b) +{ + return a ^ b; +} + +static vector int __ATTRS_o_ai +vec_xor(vector int a, vector int b) +{ + return a ^ b; +} + +static vector unsigned int __ATTRS_o_ai +vec_xor(vector unsigned int a, vector unsigned int b) +{ + return a ^ b; +} + +static vector float __ATTRS_o_ai +vec_xor(vector float a, vector float b) +{ + vector unsigned int res = (vector unsigned int)a ^ (vector unsigned int)b; + return (vector float)res; +} + +/* vec_vxor */ + +static vector signed char __ATTRS_o_ai +vec_vxor(vector signed char a, vector signed char b) +{ + return a ^ b; +} + +static vector unsigned char __ATTRS_o_ai +vec_vxor(vector unsigned char a, vector unsigned char b) +{ + return a ^ b; +} + +static vector short __ATTRS_o_ai +vec_vxor(vector short a, vector short b) +{ + return a ^ b; +} + +static vector unsigned short __ATTRS_o_ai +vec_vxor(vector unsigned short a, vector unsigned short b) +{ + return a ^ b; +} + +static vector int __ATTRS_o_ai +vec_vxor(vector int a, vector int b) +{ + return a ^ b; +} + +static vector unsigned int __ATTRS_o_ai +vec_vxor(vector unsigned int a, vector unsigned int b) +{ + return a ^ b; +} + +static vector float __ATTRS_o_ai +vec_vxor(vector float a, vector float b) +{ + vector unsigned int res = (vector unsigned int)a ^ (vector unsigned int)b; + return (vector float)res; +} + +/* ------------------------------ predicates ------------------------------------ */ + /* vec_all_eq */ -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_eq(vector signed char a, vector signed char b) { return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)a, (vector char)b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_eq(vector unsigned char a, vector unsigned char b) { return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)a, (vector char)b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_eq(vector short a, vector short b) { return __builtin_altivec_vcmpequh_p(__CR6_LT, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_eq(vector unsigned short a, vector unsigned short b) { return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)a, (vector short)b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_eq(vector int a, vector int b) { return __builtin_altivec_vcmpequw_p(__CR6_LT, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_eq(vector unsigned int a, vector unsigned int b) { return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)a, (vector int)b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_eq(vector float a, vector float b) { return __builtin_altivec_vcmpeqfp_p(__CR6_LT, a, b); @@ -884,87 +5325,87 @@ vec_all_eq(vector float a, vector float b) /* vec_all_ge */ -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_ge(vector signed char a, vector signed char b) { - return __builtin_altivec_vcmpgtsb_p(__CR6_LT, b, a); + return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, b, a); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_ge(vector unsigned char a, vector unsigned char b) { - return __builtin_altivec_vcmpgtub_p(__CR6_LT, b, a); + return __builtin_altivec_vcmpgtub_p(__CR6_EQ, b, a); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_ge(vector short a, vector short b) { - return __builtin_altivec_vcmpgtsh_p(__CR6_LT, b, a); + return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, b, a); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_ge(vector unsigned short a, vector unsigned short b) { - return __builtin_altivec_vcmpgtuh_p(__CR6_LT, b, a); + return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, b, a); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_ge(vector int a, vector int b) { - return __builtin_altivec_vcmpgtsw_p(__CR6_LT, b, a); + return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, b, a); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_ge(vector unsigned int a, vector unsigned int b) { - return __builtin_altivec_vcmpgtuw_p(__CR6_LT, b, a); + return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, b, a); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_ge(vector float a, vector float b) { - return __builtin_altivec_vcmpgtfp_p(__CR6_LT, b, a); + return __builtin_altivec_vcmpgefp_p(__CR6_LT, a, b); } /* vec_all_gt */ -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_gt(vector signed char a, vector signed char b) { return __builtin_altivec_vcmpgtsb_p(__CR6_LT, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_gt(vector unsigned char a, vector unsigned char b) { return __builtin_altivec_vcmpgtub_p(__CR6_LT, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_gt(vector short a, vector short b) { return __builtin_altivec_vcmpgtsh_p(__CR6_LT, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_gt(vector unsigned short a, vector unsigned short b) { return __builtin_altivec_vcmpgtuh_p(__CR6_LT, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_gt(vector int a, vector int b) { return __builtin_altivec_vcmpgtsw_p(__CR6_LT, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_gt(vector unsigned int a, vector unsigned int b) { return __builtin_altivec_vcmpgtuw_p(__CR6_LT, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_gt(vector float a, vector float b) { return __builtin_altivec_vcmpgtfp_p(__CR6_LT, a, b); @@ -980,87 +5421,87 @@ vec_all_in(vector float a, vector float b) /* vec_all_le */ -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_le(vector signed char a, vector signed char b) { return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_le(vector unsigned char a, vector unsigned char b) { return __builtin_altivec_vcmpgtub_p(__CR6_EQ, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_le(vector short a, vector short b) { return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_le(vector unsigned short a, vector unsigned short b) { return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_le(vector int a, vector int b) { return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_le(vector unsigned int a, vector unsigned int b) { return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_le(vector float a, vector float b) { - return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, a, b); + return __builtin_altivec_vcmpgefp_p(__CR6_LT, b, a); } /* vec_all_lt */ -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_lt(vector signed char a, vector signed char b) { return __builtin_altivec_vcmpgtsb_p(__CR6_LT, b, a); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_lt(vector unsigned char a, vector unsigned char b) { return __builtin_altivec_vcmpgtub_p(__CR6_LT, b, a); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_lt(vector short a, vector short b) { return __builtin_altivec_vcmpgtsh_p(__CR6_LT, b, a); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_lt(vector unsigned short a, vector unsigned short b) { return __builtin_altivec_vcmpgtuh_p(__CR6_LT, b, a); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_lt(vector int a, vector int b) { return __builtin_altivec_vcmpgtsw_p(__CR6_LT, b, a); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_lt(vector unsigned int a, vector unsigned int b) { return __builtin_altivec_vcmpgtuw_p(__CR6_LT, b, a); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_lt(vector float a, vector float b) { return __builtin_altivec_vcmpgtfp_p(__CR6_LT, b, a); @@ -1076,43 +5517,43 @@ vec_all_nan(vector float a) /* vec_all_ne */ -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_ne(vector signed char a, vector signed char b) { return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)a, (vector char)b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_ne(vector unsigned char a, vector unsigned char b) { return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)a, (vector char)b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_ne(vector short a, vector short b) { return __builtin_altivec_vcmpequh_p(__CR6_EQ, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_ne(vector unsigned short a, vector unsigned short b) { return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)a, (vector short)b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_ne(vector int a, vector int b) { return __builtin_altivec_vcmpequw_p(__CR6_EQ, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_ne(vector unsigned int a, vector unsigned int b) { return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)a, (vector int)b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_all_ne(vector float a, vector float b) { return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, a, b); @@ -1160,43 +5601,43 @@ vec_all_numeric(vector float a) /* vec_any_eq */ -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_eq(vector signed char a, vector signed char b) { return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)a, (vector char)b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_eq(vector unsigned char a, vector unsigned char b) { return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)a, (vector char)b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_eq(vector short a, vector short b) { return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_eq(vector unsigned short a, vector unsigned short b) { return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)a, (vector short)b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_eq(vector int a, vector int b) { return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_eq(vector unsigned int a, vector unsigned int b) { return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)a, (vector int)b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_eq(vector float a, vector float b) { return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, a, b); @@ -1204,87 +5645,87 @@ vec_any_eq(vector float a, vector float b) /* vec_any_ge */ -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_ge(vector signed char a, vector signed char b) { return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, b, a); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_ge(vector unsigned char a, vector unsigned char b) { return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, b, a); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_ge(vector short a, vector short b) { return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, b, a); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_ge(vector unsigned short a, vector unsigned short b) { return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, b, a); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_ge(vector int a, vector int b) { return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, b, a); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_ge(vector unsigned int a, vector unsigned int b) { return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, b, a); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_ge(vector float a, vector float b) { - return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, b, a); + return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, a, b); } /* vec_any_gt */ -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_gt(vector signed char a, vector signed char b) { return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_gt(vector unsigned char a, vector unsigned char b) { return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_gt(vector short a, vector short b) { return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_gt(vector unsigned short a, vector unsigned short b) { return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_gt(vector int a, vector int b) { return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_gt(vector unsigned int a, vector unsigned int b) { return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_gt(vector float a, vector float b) { return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, a, b); @@ -1292,87 +5733,87 @@ vec_any_gt(vector float a, vector float b) /* vec_any_le */ -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_le(vector signed char a, vector signed char b) { return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_le(vector unsigned char a, vector unsigned char b) { return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_le(vector short a, vector short b) { return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_le(vector unsigned short a, vector unsigned short b) { return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_le(vector int a, vector int b) { return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_le(vector unsigned int a, vector unsigned int b) { return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_le(vector float a, vector float b) { - return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, a, b); + return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, b, a); } /* vec_any_lt */ -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_lt(vector signed char a, vector signed char b) { return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, b, a); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_lt(vector unsigned char a, vector unsigned char b) { return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, b, a); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_lt(vector short a, vector short b) { return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, b, a); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_lt(vector unsigned short a, vector unsigned short b) { return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, b, a); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_lt(vector int a, vector int b) { return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, b, a); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_lt(vector unsigned int a, vector unsigned int b) { return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, b, a); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_lt(vector float a, vector float b) { return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, b, a); @@ -1388,43 +5829,43 @@ vec_any_nan(vector float a) /* vec_any_ne */ -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_ne(vector signed char a, vector signed char b) { return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)a, (vector char)b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_ne(vector unsigned char a, vector unsigned char b) { return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)a, (vector char)b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_ne(vector short a, vector short b) { return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_ne(vector unsigned short a, vector unsigned short b) { return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)a, (vector short)b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_ne(vector int a, vector int b) { return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, a, b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_ne(vector unsigned int a, vector unsigned int b) { return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)a, (vector int)b); } -static int _ATTRS_o_ai +static int __ATTRS_o_ai vec_any_ne(vector float a, vector float b) { return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, a, b); @@ -1478,6 +5919,6 @@ vec_any_out(vector float a, vector float b) return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, a, b); } -#undef _ATTRS_o_ai +#undef __ATTRS_o_ai #endif /* __ALTIVEC_H */ diff --git a/lib/Headers/arm_neon.td b/lib/Headers/arm_neon.td new file mode 100644 index 0000000..7ffbfb4 --- /dev/null +++ b/lib/Headers/arm_neon.td @@ -0,0 +1,341 @@ +//===--- arm_neon.td - ARM NEON compiler interface ------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the TableGen definitions from which the ARM NEON header +// file will be generated. See ARM document DUI0348B. +// +//===----------------------------------------------------------------------===// + +class Op; + +def OP_NONE : Op; +def OP_ADD : Op; +def OP_SUB : Op; +def OP_MUL : Op; +def OP_MLA : Op; +def OP_MLS : Op; +def OP_MUL_N : Op; +def OP_MLA_N : Op; +def OP_MLS_N : Op; +def OP_EQ : Op; +def OP_GE : Op; +def OP_LE : Op; +def OP_GT : Op; +def OP_LT : Op; +def OP_NEG : Op; +def OP_NOT : Op; +def OP_AND : Op; +def OP_OR : Op; +def OP_XOR : Op; +def OP_ANDN : Op; +def OP_ORN : Op; +def OP_CAST : Op; +def OP_HI : Op; +def OP_LO : Op; +def OP_CONC : Op; +def OP_DUP : Op; +def OP_SEL : Op; +def OP_REV64 : Op; +def OP_REV32 : Op; +def OP_REV16 : Op; + +class Inst <string p, string t, Op o> { + string Prototype = p; + string Types = t; + Op Operand = o; + bit isShift = 0; +} + +// Used to generate Builtins.def +class SInst<string p, string t> : Inst<p, t, OP_NONE> {} +class IInst<string p, string t> : Inst<p, t, OP_NONE> {} +class WInst<string p, string t> : Inst<p, t, OP_NONE> {} + +// prototype: return (arg, arg, ...) +// v: void +// t: best-fit integer (int/poly args) +// x: signed integer (int/float args) +// u: unsigned integer (int/float args) +// f: float (int args) +// d: default +// w: double width elements, same num elts +// n: double width elements, half num elts +// h: half width elements, double num elts +// e: half width elements, double num elts, unsigned +// i: constant int +// l: constant uint64 +// s: scalar of element type +// a: scalar of element type (splat to vector type) +// k: default elt width, double num elts +// #: array of default vectors +// p: pointer type +// c: const pointer type + +// sizes: +// c: char +// s: short +// i: int +// l: long +// f: float +// h: half-float + +// size modifiers: +// U: unsigned +// Q: 128b +// P: polynomial + +//////////////////////////////////////////////////////////////////////////////// +// E.3.1 Addition +def VADD : Inst<"ddd", "csilfUcUsUiUlQcQsQiQlQfQUcQUsQUiQUl", OP_ADD>; +def VADDL : SInst<"wdd", "csiUcUsUi">; +def VADDW : SInst<"wwd", "csiUcUsUi">; +def VHADD : SInst<"ddd", "csiUcUsUiQcQsQiQUcQUsQUi">; +def VRHADD : SInst<"ddd", "csiUcUsUiQcQsQiQUcQUsQUi">; +def VQADD : SInst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VADDHN : IInst<"dww", "csiUcUsUi">; +def VRADDHN : IInst<"dww", "csiUcUsUi">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.2 Multiplication +def VMUL : Inst<"ddd", "csifUcUsUiPcQcQsQiQfQUcQUsQUiQPc", OP_MUL>; +def VMLA : Inst<"dddd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_MLA>; +def VMLAL : SInst<"wwdd", "csiUcUsUi">; +def VMLS : Inst<"dddd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_MLS>; +def VMLSL : SInst<"wwdd", "csiUcUsUi">; +def VQDMULH : SInst<"ddd", "siQsQi">; +def VQRDMULH : SInst<"ddd", "siQsQi">; +def VQDMLAL : SInst<"wwdd", "si">; +def VQDMLSL : SInst<"wwdd", "si">; +def VMULL : SInst<"wdd", "csiUcUsUiPc">; +def VQDMULL : SInst<"wdd", "si">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.3 Subtraction +def VSUB : Inst<"ddd", "csilfUcUsUiUlQcQsQiQlQfQUcQUsQUiQUl", OP_SUB>; +def VSUBL : SInst<"wdd", "csiUcUsUi">; +def VSUBW : SInst<"wwd", "csiUcUsUi">; +def VQSUB : SInst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VHSUB : SInst<"ddd", "csiUcUsUiQcQsQiQUcQUsQUi">; +def VSUBHN : IInst<"dww", "csiUcUsUi">; +def VRSUBHN : IInst<"dww", "csiUcUsUi">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.4 Comparison +def VCEQ : Inst<"udd", "csifUcUsUiPcQcQsQiQfQUcQUsQUiQPc", OP_EQ>; +def VCGE : Inst<"udd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_GE>; +def VCLE : Inst<"udd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_LE>; +def VCGT : Inst<"udd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_GT>; +def VCLT : Inst<"udd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_LT>; +def VCAGE : IInst<"udd", "fQf">; +def VCALE : IInst<"udd", "fQf">; +def VCAGT : IInst<"udd", "fQf">; +def VCALT : IInst<"udd", "fQf">; +def VTST : WInst<"udd", "csiUcUsUiPcQcQsQiQUcQUsQUiQPc">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.5 Absolute Difference +def VABD : SInst<"ddd", "csiUcUsUifQcQsQiQUcQUsQUiQf">; +def VABDL : SInst<"wdd", "csiUcUsUi">; +def VABA : SInst<"dddd", "csiUcUsUiQcQsQiQUcQUsQUi">; +def VABAL : SInst<"wwdd", "csiUcUsUi">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.6 Max/Min +def VMAX : SInst<"ddd", "csiUcUsUifQcQsQiQUcQUsQUiQf">; +def VMIN : SInst<"ddd", "csiUcUsUifQcQsQiQUcQUsQUiQf">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.7 Pairdise Addition +def VPADD : IInst<"ddd", "csiUcUsUif">; +def VPADDL : SInst<"nd", "csiUcUsUiQcQsQiQUcQUsQUi">; +def VPADAL : SInst<"nnd", "csiUcUsUiQcQsQiQUcQUsQUi">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.8-9 Folding Max/Min +def VPMAX : SInst<"ddd", "csiUcUsUif">; +def VPMIN : SInst<"ddd", "csiUcUsUif">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.10 Reciprocal/Sqrt +def VRECPS : IInst<"ddd", "fQf">; +def VRSQRTS : IInst<"ddd", "fQf">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.11 Shifts by signed variable +def VSHL : SInst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VQSHL : SInst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VRSHL : SInst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VQRSHL : SInst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.12 Shifts by constant +let isShift = 1 in { +def VSHR_N : SInst<"ddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VSHL_N : IInst<"ddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VRSHR_N : SInst<"ddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VSRA_N : SInst<"dddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VRSRA_N : SInst<"dddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VQSHL_N : SInst<"ddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VQSHLU_N : SInst<"udi", "csilQcQsQiQl">; +def VSHRN_N : IInst<"hki", "silUsUiUl">; +def VQSHRUN_N : SInst<"eki", "sil">; +def VQRSHRUN_N : SInst<"eki", "sil">; +def VQSHRN_N : SInst<"hki", "silUsUiUl">; +def VRSHRN_N : IInst<"hki", "silUsUiUl">; +def VQRSHRN_N : SInst<"hki", "silUsUiUl">; +def VSHLL_N : SInst<"wdi", "csiUcUsUi">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.13 Shifts with insert +def VSRI_N : WInst<"dddi", "csilUcUsUiUlPcPsQcQsQiQlQUcQUsQUiQUlQPcQPs">; +def VSLI_N : WInst<"dddi", "csilUcUsUiUlPcPsQcQsQiQlQUcQUsQUiQUlQPcQPs">; +} + +//////////////////////////////////////////////////////////////////////////////// +// E.3.14 Loads and stores of a single vector +def VLD1 : WInst<"dc", "QUcQUsQUiQUlQcQsQiQlQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VLD1_LANE : WInst<"dci", "QUcQUsQUiQUlQcQsQiQlQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VLD1_DUP : WInst<"dc", "QUcQUsQUiQUlQcQsQiQlQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VST1 : WInst<"vpd", "QUcQUsQUiQUlQcQsQiQlQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VST1_LANE : WInst<"vpdi", "QUcQUsQUiQUlQcQsQiQlQhQfQPcQPsUcUsUiUlcsilhfPcPs">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.15 Loads and stores of an N-element structure +def VLD2 : WInst<"2c", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VLD3 : WInst<"3c", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VLD4 : WInst<"4c", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VLD2_DUP : WInst<"2c", "UcUsUiUlcsilhfPcPs">; +def VLD3_DUP : WInst<"3c", "UcUsUiUlcsilhfPcPs">; +def VLD4_DUP : WInst<"4c", "UcUsUiUlcsilhfPcPs">; +def VLD2_LANE : WInst<"2ci", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">; +def VLD3_LANE : WInst<"3ci", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">; +def VLD4_LANE : WInst<"4ci", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">; +def VST2 : WInst<"vp2", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VST3 : WInst<"vp3", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VST4 : WInst<"vp4", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VST2_LANE : WInst<"vp2i", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">; +def VST3_LANE : WInst<"vp3i", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">; +def VST4_LANE : WInst<"vp4i", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.16 Extract lanes from a vector +def VGET_LANE : IInst<"sdi", "UcUsUicsiPcPsfQUcQUsQUiQcQsQiQPcQPsQflUlQlQUl">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.17 Set lanes within a vector +def VSET_LANE : IInst<"dsdi", "UcUsUicsiPcPsfQUcQUsQUiQcQsQiQPcQPsQflUlQlQUl">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.18 Initialize a vector from bit pattern +def VCREATE: Inst<"dl", "csihfUcUsUiUlPcPsl", OP_CAST>; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.19 Set all lanes to same value +def VDUP_N : Inst<"ds", "UcUsUicsiPcPsfQUcQUsQUiQcQsQiQPcQPsQflUlQlQUl", OP_DUP>; +def VMOV_N : Inst<"ds", "UcUsUicsiPcPsfQUcQUsQUiQcQsQiQPcQPsQflUlQlQUl", OP_DUP>; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.20 Combining vectors +def VCOMBINE : Inst<"kdd", "csilhfUcUsUiUlPcPs", OP_CONC>; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.21 Splitting vectors +def VGET_HIGH : Inst<"dk", "csilhfUcUsUiUlPcPs", OP_HI>; +def VGET_LOW : Inst<"dk", "csilhfUcUsUiUlPcPs", OP_LO>; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.22 Converting vectors +def VCVT_S32 : SInst<"xd", "fQf">; +def VCVT_U32 : SInst<"ud", "fQf">; +def VCVT_F16 : SInst<"hk", "f">; +def VCVT_N_S32 : SInst<"xdi", "fQf">; +def VCVT_N_U32 : SInst<"udi", "fQf">; +def VCVT_F32 : SInst<"fd", "iUiQiQUi">; +def VCVT_F32_F16 : SInst<"kh", "f">; +def VCVT_N_F32 : SInst<"fdi", "iUiQiQUi">; +def VMOVN : IInst<"hk", "silUsUiUl">; +def VMOVL : SInst<"wd", "csiUcUsUi">; +def VQMOVN : SInst<"hk", "silUsUiUl">; +def VQMOVUN : SInst<"ek", "sil">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.23-24 Table lookup, Extended table lookup +def VTBL1 : WInst<"ddt", "UccPc">; +def VTBL2 : WInst<"d2t", "UccPc">; +def VTBL3 : WInst<"d3t", "UccPc">; +def VTBL4 : WInst<"d4t", "UccPc">; +def VTBX1 : WInst<"dddt", "UccPc">; +def VTBX2 : WInst<"dd2t", "UccPc">; +def VTBX3 : WInst<"dd3t", "UccPc">; +def VTBX4 : WInst<"dd4t", "UccPc">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.25 Operations with a scalar value +def VMLA_LANE : IInst<"ddddi", "siUsUifQsQiQUsQUiQf">; +def VMLAL_LANE : SInst<"wwddi", "siUsUi">; +def VQDMLAL_LANE : SInst<"wwddi", "si">; +def VMLS_LANE : IInst<"ddddi", "siUsUifQsQiQUsQUiQf">; +def VMLSL_LANE : SInst<"wwddi", "siUsUi">; +def VQDMLSL_LANE : SInst<"wwddi", "si">; +def VMUL_N : Inst<"dds", "sifUsUiQsQiQfQUsQUi", OP_MUL_N>; +def VMULL_N : SInst<"wda", "siUsUi">; +def VMULL_LANE : SInst<"wddi", "siUsUi">; +def VQDMULL_N : SInst<"wda", "si">; +def VQDMULL_LANE : SInst<"wddi", "si">; +def VQDMULH_N : SInst<"dda", "siQsQi">; +def VQDMULH_LANE : SInst<"dddi", "siQsQi">; +def VQRDMULH_N : SInst<"dda", "siQsQi">; +def VQRDMULH_LANE : SInst<"dddi", "siQsQi">; +def VMLA_N : Inst<"ddda", "siUsUifQsQiQUsQUiQf", OP_MLA_N>; +def VMLAL_N : SInst<"wwda", "siUsUi">; +def VQDMLAL_N : SInst<"wwda", "si">; +def VMLS_N : Inst<"ddds", "siUsUifQsQiQUsQUiQf", OP_MLS_N>; +def VMLSL_N : SInst<"wwda", "siUsUi">; +def VQDMLSL_N : SInst<"wwda", "si">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.26 Vector Extract +def VEXT : WInst<"dddi", "cUcPcsUsPsiUilUlQcQUcQPcQsQUsQPsQiQUiQlQUl">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.27 Reverse vector elements (sdap endianness) +def VREV64 : Inst<"dd", "csiUcUsUiPcPsfQcQsQiQUcQUsQUiQPcQPsQf", OP_REV64>; +def VREV32 : Inst<"dd", "csUcUsPcQcQsQUcQUsQPc", OP_REV32>; +def VREV16 : Inst<"dd", "cUcPcQcQUcQPc", OP_REV16>; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.28 Other single operand arithmetic +def VABS : SInst<"dd", "csifQcQsQiQf">; +def VQABS : SInst<"dd", "csiQcQsQi">; +def VNEG : Inst<"dd", "csifQcQsQiQf", OP_NEG>; +def VQNEG : SInst<"dd", "csiQcQsQi">; +def VCLS : SInst<"dd", "csiQcQsQi">; +def VCLZ : IInst<"dd", "csiUcUsUiQcQsQiQUcQUsQUi">; +def VCNT : WInst<"dd", "UccPcQUcQcQPc">; +def VRECPE : SInst<"dd", "fUiQfQUi">; +def VRSQRTE : SInst<"dd", "fUiQfQUi">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.29 Logical operations +def VMVN : Inst<"dd", "csiUcUsUiPcQcQsQiQUcQUsQUiQPc", OP_NOT>; +def VAND : Inst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl", OP_AND>; +def VORR : Inst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl", OP_OR>; +def VEOR : Inst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl", OP_XOR>; +def VBIC : Inst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl", OP_ANDN>; +def VORN : Inst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl", OP_ORN>; +def VBSL : Inst<"dudd", "csilUcUsUiUlfPcPsQcQsQiQlQUcQUsQUiQUlQfQPcQPs", OP_SEL>; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.30 Transposition operations +def VTRN: WInst<"2dd", "csiUcUsUifPcPsQcQsQiQUcQUsQUiQfQPcQPs">; +def VZIP: WInst<"2dd", "csUcUsfPcPsQcQsQiQUcQUsQUiQfQPcQPs">; +def VUZP: WInst<"2dd", "csiUcUsUifPcPsQcQsQiQUcQUsQUiQfQPcQPs">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.31 Vector reinterpret cast operations diff --git a/lib/Headers/emmintrin.h b/lib/Headers/emmintrin.h index 8afbe76..f297f36 100644 --- a/lib/Headers/emmintrin.h +++ b/lib/Headers/emmintrin.h @@ -1222,9 +1222,10 @@ _mm_movemask_epi8(__m128i a) 4, 5, 6, 7)) #define _mm_shufflehi_epi16(a, imm) \ ((__m128i)__builtin_shufflevector((__v8hi)(a), (__v8hi) {0}, 0, 1, 2, 3, \ - 4 + ((imm) & 0x3), 4 + ((imm) & 0xc) >> 2, \ - 4 + ((imm) & 0x30) >> 4, \ - 4 + ((imm) & 0xc0) >> 6)) + 4 + (((imm) & 0x03) >> 0), \ + 4 + (((imm) & 0x0c) >> 2), \ + 4 + (((imm) & 0x30) >> 4), \ + 4 + (((imm) & 0xc0) >> 6))) static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_unpackhi_epi8(__m128i a, __m128i b) diff --git a/lib/Headers/smmintrin.h b/lib/Headers/smmintrin.h index e271f99..4b0d9e7 100644 --- a/lib/Headers/smmintrin.h +++ b/lib/Headers/smmintrin.h @@ -183,13 +183,13 @@ _mm_max_epu32 (__m128i __V1, __m128i __V2) #define _mm_insert_ps(X, Y, N) __builtin_ia32_insertps128((X), (Y), (N)) #define _mm_extract_ps(X, N) (__extension__ \ ({ union { int i; float f; } __t; \ - __v4sf __a = (__v4sf)X; \ + __v4sf __a = (__v4sf)(X); \ __t.f = __a[N]; \ __t.i;})) /* Miscellaneous insert and extract macros. */ /* Extract a single-precision float from X at index N into D. */ -#define _MM_EXTRACT_FLOAT(D, X, N) (__extension__ ({ __v4sf __a = (__v4sf)X; \ +#define _MM_EXTRACT_FLOAT(D, X, N) (__extension__ ({ __v4sf __a = (__v4sf)(X); \ (D) = __a[N]; })) /* Or together 2 sets of indexes (X and Y) with the zeroing bits (Z) to create @@ -201,25 +201,25 @@ _mm_max_epu32 (__m128i __V1, __m128i __V2) _MM_MK_INSERTPS_NDX((N), 0, 0x0e)) /* Insert int into packed integer array at index. */ -#define _mm_insert_epi8(X, I, N) (__extension__ ({ __v16qi __a = (__v16qi)X; \ +#define _mm_insert_epi8(X, I, N) (__extension__ ({ __v16qi __a = (__v16qi)(X); \ __a[N] = I; \ __a;})) -#define _mm_insert_epi32(X, I, N) (__extension__ ({ __v4si __a = (__v4si)X; \ +#define _mm_insert_epi32(X, I, N) (__extension__ ({ __v4si __a = (__v4si)(X); \ __a[N] = I; \ __a;})) #ifdef __x86_64__ -#define _mm_insert_epi64(X, I, N) (__extension__ ({ __v2di __a = (__v2di)X; \ +#define _mm_insert_epi64(X, I, N) (__extension__ ({ __v2di __a = (__v2di)(X); \ __a[N] = I; \ __a;})) #endif /* __x86_64__ */ /* Extract int from packed integer array at index. */ -#define _mm_extract_epi8(X, N) (__extension__ ({ __v16qi __a = (__v16qi)X; \ +#define _mm_extract_epi8(X, N) (__extension__ ({ __v16qi __a = (__v16qi)(X); \ __a[N];})) -#define _mm_extract_epi32(X, N) (__extension__ ({ __v4si __a = (__v4si)X; \ +#define _mm_extract_epi32(X, N) (__extension__ ({ __v4si __a = (__v4si)(X); \ __a[N];})) #ifdef __x86_64__ -#define _mm_extract_epi64(X, N) (__extension__ ({ __v2di __a = (__v2di)X; \ +#define _mm_extract_epi64(X, N) (__extension__ ({ __v2di __a = (__v2di)(X); \ __a[N];})) #endif /* __x86_64 */ diff --git a/lib/Headers/stddef.h b/lib/Headers/stddef.h index 6868ad3..b1d0d52 100644 --- a/lib/Headers/stddef.h +++ b/lib/Headers/stddef.h @@ -45,6 +45,13 @@ typedef __typeof__(*L"") wchar_t; #define NULL ((void*)0) #endif +// Some C libraries expect to see a wint_t here. Others (notably MinGW) will use +// __WINT_TYPE__ directly; accomodate both by requiring __need_wint_t +#if defined(__need_wint_t) && !defined(_WINT_T) +#define _WINT_T +typedef __WINT_TYPE__ wint_t; +#endif + #define offsetof(t, d) __builtin_offsetof(t, d) #endif /* __STDDEF_H */ diff --git a/lib/Headers/stdint.h b/lib/Headers/stdint.h index 1785f31..9498ed5 100644 --- a/lib/Headers/stdint.h +++ b/lib/Headers/stdint.h @@ -233,8 +233,8 @@ typedef __uintn_t(__INTPTR_WIDTH__) uintptr_t; /* C99 7.18.1.5 Greatest-width integer types. */ -typedef __intn_t(__INTMAX_WIDTH__) intmax_t; -typedef __uintn_t(__INTMAX_WIDTH__) uintmax_t; +typedef __INTMAX_TYPE__ intmax_t; +typedef __UINTMAX_TYPE__ uintmax_t; /* C99 7.18.4 Macros for minimum-width integer constants. * diff --git a/lib/Headers/xmmintrin.h b/lib/Headers/xmmintrin.h index 3e82e28..75e06b5 100644 --- a/lib/Headers/xmmintrin.h +++ b/lib/Headers/xmmintrin.h @@ -607,10 +607,10 @@ _mm_storer_ps(float *p, __m128 a) #define _MM_HINT_T2 3 #define _MM_HINT_NTA 0 -/* FIXME: We have to #define this because "sel" must be a constant integer, and +/* FIXME: We have to #define this because "sel" must be a constant integer, and Sema doesn't do any form of constant propagation yet. */ -#define _mm_prefetch(a, sel) (__builtin_prefetch((void *)a, 0, sel)) +#define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, sel)) static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_stream_pi(__m64 *p, __m64 a) @@ -723,7 +723,7 @@ _mm_setcsr(unsigned int i) } #define _mm_shuffle_ps(a, b, mask) \ - (__builtin_shufflevector((__v4sf)a, (__v4sf)b, \ + (__builtin_shufflevector((__v4sf)(a), (__v4sf)(b), \ (mask) & 0x3, ((mask) & 0xc) >> 2, \ (((mask) & 0x30) >> 4) + 4, \ (((mask) & 0xc0) >> 6) + 4)) |