mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-27 22:33:17 +00:00
Fix 64 bit compile errors
This commit is contained in:
parent
8765cf2016
commit
c960742dbd
42 changed files with 99 additions and 62 deletions
|
@ -258,9 +258,7 @@ endif()
|
|||
set( LLVM_COMPONENTS core support asmparser asmprinter bitreader codegen passes ipo
|
||||
irreader transformutils instrumentation profiledata debuginfocodeview runtimedyld
|
||||
object instcombine linker analysis selectiondag scalaropts vectorize executionengine
|
||||
mc mcdisassembler mcparser mcjit target )
|
||||
set( LLVM_COMPONENTS_X86 x86asmprinter x86info x86desc x86utils x86codegen )
|
||||
set( LLVM_COMPONENTS_X64 aarch64asmprinter aarch64info aarch64desc aarch64utils aarch64codegen )
|
||||
mc mcdisassembler mcparser mcjit target x86asmprinter x86info x86desc x86utils x86codegen )
|
||||
|
||||
# Path where it looks for the LLVM compiled files on Windows
|
||||
set( LLVM_PRECOMPILED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../llvm" )
|
||||
|
@ -270,24 +268,22 @@ if( NOT WIN32 )
|
|||
find_package(LLVM REQUIRED CONFIG)
|
||||
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
|
||||
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
|
||||
llvm_map_components_to_libnames( llvm_libs ${LLVM_COMPONENTS} ${LLVM_COMPONENTS_X86} ${LLVM_COMPONENTS_X64} )
|
||||
llvm_map_components_to_libnames( llvm_libs ${LLVM_COMPONENTS} )
|
||||
include_directories( ${LLVM_INCLUDE_DIRS} )
|
||||
set( ZDOOM_LIBS ${ZDOOM_LIBS} ${llvm_libs} )
|
||||
else()
|
||||
include_directories( "${LLVM_PRECOMPILED_DIR}/include" )
|
||||
if( X64 )
|
||||
include_directories( "${LLVM_PRECOMPILED_DIR}/64bit/include" )
|
||||
set( llvm_libs_base "${LLVM_PRECOMPILED_DIR}/llvm/64bit" )
|
||||
set( LLVM_ALL_COMPONENTS ${LLVM_COMPONENTS} ${LLVM_COMPONENTS_X64} )
|
||||
include_directories( "${LLVM_PRECOMPILED_DIR}/64bit-include" )
|
||||
set( llvm_libs_base "${LLVM_PRECOMPILED_DIR}/64bit-" )
|
||||
else()
|
||||
include_directories( "${LLVM_PRECOMPILED_DIR}/32bit/include" )
|
||||
set( llvm_libs_base "${LLVM_PRECOMPILED_DIR}/32bit" )
|
||||
set( LLVM_ALL_COMPONENTS ${LLVM_COMPONENTS} ${LLVM_COMPONENTS_X86} )
|
||||
include_directories( "${LLVM_PRECOMPILED_DIR}/32bit-include" )
|
||||
set( llvm_libs_base "${LLVM_PRECOMPILED_DIR}/32bit-" )
|
||||
endif()
|
||||
foreach(buildtype IN ITEMS RELEASE DEBUG)
|
||||
set( llvm_libs_${buildtype} "${llvm_libs_base}/${buildtype}" )
|
||||
set( llvm_libs_${buildtype} "${llvm_libs_base}${buildtype}" )
|
||||
set( LLVM_${buildtype}_LIBS "" )
|
||||
foreach( llvm_module ${LLVM_ALL_COMPONENTS} )
|
||||
foreach( llvm_module ${LLVM_COMPONENTS} )
|
||||
find_library( LLVM_${llvm_module}_LIBRARY_${buildtype} LLVM${llvm_module} PATHS ${llvm_libs_${buildtype}} )
|
||||
set( LLVM_${buildtype}_LIBS ${LLVM_${buildtype}_LIBS} ${LLVM_${llvm_module}_LIBRARY_${buildtype}} )
|
||||
endforeach( llvm_module )
|
||||
|
@ -1492,6 +1488,10 @@ set_source_files_properties( sc_man.cpp PROPERTIES OBJECT_DEPENDS "${CMAKE_CURRE
|
|||
set_source_files_properties( ${NOT_COMPILED_SOURCE_FILES} PROPERTIES HEADER_FILE_ONLY TRUE )
|
||||
if ( WIN32 )
|
||||
set_source_files_properties( win32/fb_d3d9.cpp win32/fb_d3d9_wipe.cpp PROPERTIES COMPILE_FLAGS ${ZD_FASTMATH_FLAG} )
|
||||
|
||||
# Supress C4244: 'initializing': conversion from '__int64' to 'unsigned int', possible loss of data
|
||||
# For some reason using #pragma warning(disable: 4244) is not working..
|
||||
set_source_files_properties( ${PCH_SOURCES} PROPERTIES COMPILE_FLAGS /wd4244 )
|
||||
endif()
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
#include "i_system.h"
|
||||
#include "r_compiler/llvm_include.h"
|
||||
#include "r_compiler/fixedfunction/drawcolumncodegen.h"
|
||||
#include "r_compiler/ssa/ssa_function.h"
|
||||
#include "r_compiler/ssa/ssa_scope.h"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
#include "i_system.h"
|
||||
#include "r_compiler/llvm_include.h"
|
||||
#include "r_compiler/fixedfunction/drawercodegen.h"
|
||||
#include "r_compiler/ssa/ssa_function.h"
|
||||
#include "r_compiler/ssa/ssa_scope.h"
|
||||
|
@ -17,17 +18,17 @@ SSABool DrawerCodegen::line_skipped_by_thread(SSAInt line, SSAWorkerThread threa
|
|||
|
||||
SSAInt DrawerCodegen::skipped_by_thread(SSAInt first_line, SSAWorkerThread thread)
|
||||
{
|
||||
SSAInt pass_skip = SSAInt::MAX(thread.pass_start_y - first_line, 0);
|
||||
SSAInt pass_skip = SSAInt::MAX(thread.pass_start_y - first_line, SSAInt(0));
|
||||
SSAInt core_skip = (thread.num_cores - (first_line + pass_skip - thread.core) % thread.num_cores) % thread.num_cores;
|
||||
return pass_skip + core_skip;
|
||||
}
|
||||
|
||||
SSAInt DrawerCodegen::count_for_thread(SSAInt first_line, SSAInt count, SSAWorkerThread thread)
|
||||
{
|
||||
SSAInt lines_until_pass_end = SSAInt::MAX(thread.pass_end_y - first_line, 0);
|
||||
SSAInt lines_until_pass_end = SSAInt::MAX(thread.pass_end_y - first_line, SSAInt(0));
|
||||
count = SSAInt::MIN(count, lines_until_pass_end);
|
||||
SSAInt c = (count - skipped_by_thread(first_line, thread) + thread.num_cores - 1) / thread.num_cores;
|
||||
return SSAInt::MAX(c, 0);
|
||||
return SSAInt::MAX(c, SSAInt(0));
|
||||
}
|
||||
|
||||
SSAUBytePtr DrawerCodegen::dest_for_thread(SSAInt first_line, SSAInt pitch, SSAUBytePtr dest, SSAWorkerThread thread)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
#include "i_system.h"
|
||||
#include "r_compiler/llvm_include.h"
|
||||
#include "r_compiler/fixedfunction/drawspancodegen.h"
|
||||
#include "r_compiler/ssa/ssa_function.h"
|
||||
#include "r_compiler/ssa/ssa_scope.h"
|
||||
|
@ -49,9 +50,9 @@ void DrawSpanCodegen::Generate(DrawSpanVariant variant, SSAValue args)
|
|||
xmask = ((SSAInt(1) << xbits) - 1) << ybits;
|
||||
|
||||
// 64x64 is the most common case by far, so special case it.
|
||||
is_64x64 = xbits == 6 && ybits == 6;
|
||||
is_simple_shade = (flags & DrawSpanArgs::simple_shade) == DrawSpanArgs::simple_shade;
|
||||
is_nearest_filter = (flags & DrawSpanArgs::nearest_filter) == DrawSpanArgs::nearest_filter;
|
||||
is_64x64 = xbits == SSAInt(6) && ybits == SSAInt(6);
|
||||
is_simple_shade = (flags & DrawSpanArgs::simple_shade) == SSAInt(DrawSpanArgs::simple_shade);
|
||||
is_nearest_filter = (flags & DrawSpanArgs::nearest_filter) == SSAInt(DrawSpanArgs::nearest_filter);
|
||||
|
||||
SSAIfBlock branch;
|
||||
branch.if_block(is_simple_shade);
|
||||
|
@ -90,7 +91,7 @@ void DrawSpanCodegen::LoopFilter(DrawSpanVariant variant, bool isSimpleShade, bo
|
|||
SSAInt DrawSpanCodegen::Loop4x(DrawSpanVariant variant, bool isSimpleShade, bool isNearestFilter, bool is64x64)
|
||||
{
|
||||
SSAInt sseLength = count / 4;
|
||||
stack_index.store(0);
|
||||
stack_index.store(SSAInt(0));
|
||||
{
|
||||
SSAForBlock loop;
|
||||
SSAInt index = stack_index.load();
|
||||
|
@ -165,7 +166,7 @@ SSAVec4i DrawSpanCodegen::Sample(SSAInt xfrac, SSAInt yfrac, bool isNearestFilte
|
|||
{
|
||||
if (is64x64)
|
||||
{
|
||||
return sample_linear(source, xfrac, yfrac, 26, 26);
|
||||
return sample_linear(source, xfrac, yfrac, SSAInt(26), SSAInt(26));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
#include "i_system.h"
|
||||
#include "r_compiler/llvm_include.h"
|
||||
#include "r_compiler/fixedfunction/drawwallcodegen.h"
|
||||
#include "r_compiler/ssa/ssa_function.h"
|
||||
#include "r_compiler/ssa/ssa_scope.h"
|
||||
|
@ -65,8 +66,8 @@ void DrawWallCodegen::Generate(DrawWallVariant variant, bool fourColumns, SSAVal
|
|||
thread.pass_start_y = thread_data[0][2].load();
|
||||
thread.pass_end_y = thread_data[0][3].load();
|
||||
|
||||
is_simple_shade = (flags & DrawWallArgs::simple_shade) == DrawWallArgs::simple_shade;
|
||||
is_nearest_filter = (flags & DrawWallArgs::nearest_filter) == DrawWallArgs::nearest_filter;
|
||||
is_simple_shade = (flags & DrawWallArgs::simple_shade) == SSAInt(DrawWallArgs::simple_shade);
|
||||
is_nearest_filter = (flags & DrawWallArgs::nearest_filter) == SSAInt(DrawWallArgs::nearest_filter);
|
||||
|
||||
count = count_for_thread(dest_y, count, thread);
|
||||
dest = dest_for_thread(dest_y, pitch, dest, thread);
|
||||
|
@ -103,7 +104,7 @@ void DrawWallCodegen::Loop(DrawWallVariant variant, bool fourColumns, bool isSim
|
|||
{
|
||||
int numColumns = fourColumns ? 4 : 1;
|
||||
|
||||
stack_index.store(0);
|
||||
stack_index.store(SSAInt(0));
|
||||
{
|
||||
SSAForBlock loop;
|
||||
SSAInt index = stack_index.load();
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#if defined(min)
|
||||
#define llvm_min_bug min
|
||||
#undef min
|
||||
|
@ -18,6 +20,10 @@
|
|||
#pragma warning(disable: 4244) // warning C4244: 'return' : conversion from 'uint64_t' to 'unsigned int', possible loss of data
|
||||
#pragma warning(disable: 4141) // warning C4141: 'inline': used more than once
|
||||
#pragma warning(disable: 4291) // warning C4291: 'void *llvm::User::operator new(std::size_t,unsigned int,unsigned int)': no matching operator delete found; memory will not be freed if initialization throws an exception
|
||||
#pragma warning(disable: 4267) // warning C4267: 'return': conversion from 'size_t' to 'unsigned int', possible loss of data
|
||||
#pragma warning(disable: 4244) // warning C4244: 'initializing': conversion from '__int64' to 'unsigned int', possible loss of data
|
||||
|
||||
#endif
|
||||
|
||||
#include <llvm/IR/DerivedTypes.h>
|
||||
#include <llvm/IR/LLVMContext.h>
|
||||
|
@ -39,6 +45,8 @@
|
|||
#include <llvm/CodeGen/AsmPrinter.h>
|
||||
#include <llvm/MC/MCAsmInfo.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#if defined(llvm_min_bug)
|
||||
#define min llvm_min_bug
|
||||
#undef llvm_min_bug
|
||||
|
@ -47,3 +55,5 @@
|
|||
#define max llvm_max_bug
|
||||
#undef llvm_max_bug
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
#include "i_system.h"
|
||||
#include "r_compiler/llvm_include.h"
|
||||
#include "r_compiler/fixedfunction/drawspancodegen.h"
|
||||
#include "r_compiler/fixedfunction/drawwallcodegen.h"
|
||||
#include "r_compiler/fixedfunction/drawcolumncodegen.h"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
#include "r_compiler/llvm_include.h"
|
||||
#include "ssa_bool.h"
|
||||
#include "ssa_scope.h"
|
||||
#include "r_compiler/llvm_include.h"
|
||||
|
||||
SSABool::SSABool()
|
||||
: v(0)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
#include "r_compiler/llvm_include.h"
|
||||
#include "ssa_float.h"
|
||||
#include "ssa_int.h"
|
||||
#include "ssa_scope.h"
|
||||
#include "r_compiler/llvm_include.h"
|
||||
|
||||
SSAFloat::SSAFloat()
|
||||
: v(0)
|
||||
|
|
|
@ -11,7 +11,7 @@ class SSAFloat
|
|||
public:
|
||||
SSAFloat();
|
||||
SSAFloat(SSAInt i);
|
||||
SSAFloat(float constant);
|
||||
explicit SSAFloat(float constant);
|
||||
explicit SSAFloat(llvm::Value *v);
|
||||
static SSAFloat from_llvm(llvm::Value *v) { return SSAFloat(v); }
|
||||
static llvm::Type *llvm_type();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
#include "r_compiler/llvm_include.h"
|
||||
#include "ssa_float_ptr.h"
|
||||
#include "ssa_scope.h"
|
||||
#include "r_compiler/llvm_include.h"
|
||||
|
||||
SSAFloatPtr::SSAFloatPtr()
|
||||
: v(0)
|
||||
|
|
|
@ -16,6 +16,7 @@ public:
|
|||
static SSAFloatPtr from_llvm(llvm::Value *v) { return SSAFloatPtr(v); }
|
||||
static llvm::Type *llvm_type();
|
||||
SSAFloatPtr operator[](SSAInt index) const;
|
||||
SSAFloatPtr operator[](int index) const { return (*this)[SSAInt(index)]; }
|
||||
SSAFloat load() const;
|
||||
SSAVec4f load_vec4f() const;
|
||||
SSAVec4f load_unaligned_vec4f() const;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
|
||||
#include "r_compiler/llvm_include.h"
|
||||
#include "ssa_for_block.h"
|
||||
#include "ssa_scope.h"
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "ssa_bool.h"
|
||||
#include "r_compiler/llvm_include.h"
|
||||
|
||||
class SSAForBlock
|
||||
{
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
#include "r_compiler/llvm_include.h"
|
||||
#include "ssa_function.h"
|
||||
#include "ssa_int.h"
|
||||
#include "ssa_scope.h"
|
||||
#include "ssa_value.h"
|
||||
#include "r_compiler/llvm_include.h"
|
||||
|
||||
SSAFunction::SSAFunction(const std::string name)
|
||||
: name(name), return_type(llvm::Type::getVoidTy(SSAScope::context())), func()
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
|
||||
#include "r_compiler/llvm_include.h"
|
||||
#include "ssa_if_block.h"
|
||||
#include "ssa_scope.h"
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include "ssa_bool.h"
|
||||
#include "ssa_phi.h"
|
||||
#include "r_compiler/llvm_include.h"
|
||||
|
||||
class SSAIfBlock
|
||||
{
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
#include "r_compiler/llvm_include.h"
|
||||
#include "ssa_int.h"
|
||||
#include "ssa_float.h"
|
||||
#include "ssa_bool.h"
|
||||
#include "ssa_scope.h"
|
||||
#include "r_compiler/llvm_include.h"
|
||||
|
||||
SSAInt::SSAInt()
|
||||
: v(0)
|
||||
|
|
|
@ -10,7 +10,7 @@ class SSAInt
|
|||
{
|
||||
public:
|
||||
SSAInt();
|
||||
SSAInt(int constant);
|
||||
explicit SSAInt(int constant);
|
||||
SSAInt(SSAFloat f);
|
||||
explicit SSAInt(llvm::Value *v);
|
||||
static SSAInt from_llvm(llvm::Value *v) { return SSAInt(v); }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
#include "r_compiler/llvm_include.h"
|
||||
#include "ssa_int_ptr.h"
|
||||
#include "ssa_scope.h"
|
||||
#include "r_compiler/llvm_include.h"
|
||||
|
||||
SSAIntPtr::SSAIntPtr()
|
||||
: v(0)
|
||||
|
|
|
@ -16,6 +16,7 @@ public:
|
|||
static SSAIntPtr from_llvm(llvm::Value *v) { return SSAIntPtr(v); }
|
||||
static llvm::Type *llvm_type();
|
||||
SSAIntPtr operator[](SSAInt index) const;
|
||||
SSAIntPtr operator[](int index) const { return (*this)[SSAInt(index)]; }
|
||||
SSAInt load() const;
|
||||
SSAVec4i load_vec4i() const;
|
||||
SSAVec4i load_unaligned_vec4i() const;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
|
||||
#include "r_compiler/llvm_include.h"
|
||||
#include "ssa_scope.h"
|
||||
#include "ssa_int.h"
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "r_compiler/llvm_include.h"
|
||||
|
||||
class SSAInt;
|
||||
|
||||
class SSAScope
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
#include "r_compiler/llvm_include.h"
|
||||
#include "ssa_short.h"
|
||||
#include "ssa_float.h"
|
||||
#include "ssa_int.h"
|
||||
#include "ssa_scope.h"
|
||||
#include "r_compiler/llvm_include.h"
|
||||
|
||||
SSAShort::SSAShort()
|
||||
: v(0)
|
||||
|
|
|
@ -11,7 +11,7 @@ class SSAShort
|
|||
{
|
||||
public:
|
||||
SSAShort();
|
||||
SSAShort(int constant);
|
||||
explicit SSAShort(int constant);
|
||||
SSAShort(SSAFloat f);
|
||||
explicit SSAShort(llvm::Value *v);
|
||||
static SSAShort from_llvm(llvm::Value *v) { return SSAShort(v); }
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
|
||||
#include "r_compiler/llvm_include.h"
|
||||
#include "ssa_struct_type.h"
|
||||
#include "ssa_scope.h"
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
#include "r_compiler/llvm_include.h"
|
||||
#include "ssa_ubyte.h"
|
||||
#include "ssa_scope.h"
|
||||
#include "r_compiler/llvm_include.h"
|
||||
|
||||
SSAUByte::SSAUByte()
|
||||
: v(0)
|
||||
|
|
|
@ -8,7 +8,7 @@ class SSAUByte
|
|||
{
|
||||
public:
|
||||
SSAUByte();
|
||||
SSAUByte(unsigned char constant);
|
||||
explicit SSAUByte(unsigned char constant);
|
||||
explicit SSAUByte(llvm::Value *v);
|
||||
static SSAUByte from_llvm(llvm::Value *v) { return SSAUByte(v); }
|
||||
static llvm::Type *llvm_type();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
#include "r_compiler/llvm_include.h"
|
||||
#include "ssa_ubyte_ptr.h"
|
||||
#include "ssa_scope.h"
|
||||
#include "r_compiler/llvm_include.h"
|
||||
|
||||
SSAUBytePtr::SSAUBytePtr()
|
||||
: v(0)
|
||||
|
@ -38,7 +38,7 @@ SSAVec4i SSAUBytePtr::load_vec4ub() const
|
|||
v = SSAScope::builder().CreateInsertElement(v, SSAInt(0).v, SSAInt(3).v, SSAScope::hint());
|
||||
SSAVec4i v4i = SSAVec4i::from_llvm(v);
|
||||
|
||||
SSAVec8s low = SSAVec8s::bitcast(SSAVec16ub::shuffle(SSAVec16ub::bitcast(v4i), 0, 0, 16+0, 1, 16+1, 2, 16+2, 3, 16+3, 4, 16+4, 5, 16+5, 6, 16+6, 7, 16+7)); // _mm_unpacklo_epi8
|
||||
SSAVec8s low = SSAVec8s::bitcast(SSAVec16ub::shuffle(SSAVec16ub::bitcast(v4i), SSAVec16ub((unsigned char)0), 0, 16+0, 1, 16+1, 2, 16+2, 3, 16+3, 4, 16+4, 5, 16+5, 6, 16+6, 7, 16+7)); // _mm_unpacklo_epi8
|
||||
return SSAVec4i::extendlo(low); // _mm_unpacklo_epi16
|
||||
/*
|
||||
llvm::PointerType *m4xint8typeptr = llvm::VectorType::get(llvm::Type::getInt8Ty(SSAScope::context()), 4)->getPointerTo();
|
||||
|
|
|
@ -18,6 +18,7 @@ public:
|
|||
static SSAUBytePtr from_llvm(llvm::Value *v) { return SSAUBytePtr(v); }
|
||||
static llvm::Type *llvm_type();
|
||||
SSAUBytePtr operator[](SSAInt index) const;
|
||||
SSAUBytePtr operator[](int index) const { return (*this)[SSAInt(index)]; }
|
||||
SSAUByte load() const;
|
||||
SSAVec4i load_vec4ub() const;
|
||||
SSAVec8s load_vec8s() const;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
#include "r_compiler/llvm_include.h"
|
||||
#include "ssa_value.h"
|
||||
#include "ssa_int.h"
|
||||
#include "ssa_scope.h"
|
||||
#include "r_compiler/llvm_include.h"
|
||||
|
||||
SSAValue SSAValue::load()
|
||||
{
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
#include "r_compiler/llvm_include.h"
|
||||
#include "ssa_vec16ub.h"
|
||||
#include "ssa_vec8s.h"
|
||||
#include "ssa_vec4i.h"
|
||||
#include "ssa_scope.h"
|
||||
#include "r_compiler/llvm_include.h"
|
||||
|
||||
SSAVec16ub::SSAVec16ub()
|
||||
: v(0)
|
||||
|
|
|
@ -11,8 +11,8 @@ class SSAVec16ub
|
|||
{
|
||||
public:
|
||||
SSAVec16ub();
|
||||
SSAVec16ub(unsigned char constant);
|
||||
SSAVec16ub(
|
||||
explicit SSAVec16ub(unsigned char constant);
|
||||
explicit SSAVec16ub(
|
||||
unsigned char constant0, unsigned char constant1, unsigned char constant2, unsigned char constant3, unsigned char constant4, unsigned char constant5, unsigned char constant6, unsigned char constant7,
|
||||
unsigned char constant8, unsigned char constant9, unsigned char constant10, unsigned char constant11, unsigned char constant12, unsigned char constant13, unsigned char constant14, unsigned char constant15);
|
||||
explicit SSAVec16ub(llvm::Value *v);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
#include "r_compiler/llvm_include.h"
|
||||
#include "ssa_vec4f.h"
|
||||
#include "ssa_vec4i.h"
|
||||
#include "ssa_float.h"
|
||||
#include "ssa_int.h"
|
||||
#include "ssa_scope.h"
|
||||
#include "r_compiler/llvm_include.h"
|
||||
|
||||
SSAVec4f::SSAVec4f()
|
||||
: v(0)
|
||||
|
@ -75,6 +75,11 @@ SSAFloat SSAVec4f::operator[](SSAInt index) const
|
|||
return SSAFloat::from_llvm(SSAScope::builder().CreateExtractElement(v, index.v, SSAScope::hint()));
|
||||
}
|
||||
|
||||
SSAFloat SSAVec4f::operator[](int index) const
|
||||
{
|
||||
return (*this)[SSAInt(index)];
|
||||
}
|
||||
|
||||
SSAVec4f SSAVec4f::insert_element(SSAVec4f vec4f, SSAFloat value, int index)
|
||||
{
|
||||
return from_llvm(SSAScope::builder().CreateInsertElement(vec4f.v, value.v, llvm::ConstantInt::get(SSAScope::context(), llvm::APInt(32, (uint64_t)index))));
|
||||
|
|
|
@ -12,13 +12,14 @@ class SSAVec4f
|
|||
{
|
||||
public:
|
||||
SSAVec4f();
|
||||
SSAVec4f(float constant);
|
||||
SSAVec4f(float constant0, float constant1, float constant2, float constant3);
|
||||
explicit SSAVec4f(float constant);
|
||||
explicit SSAVec4f(float constant0, float constant1, float constant2, float constant3);
|
||||
SSAVec4f(SSAFloat f);
|
||||
SSAVec4f(SSAFloat f0, SSAFloat f1, SSAFloat f2, SSAFloat f3);
|
||||
explicit SSAVec4f(llvm::Value *v);
|
||||
SSAVec4f(SSAVec4i i32);
|
||||
SSAFloat operator[](SSAInt index) const;
|
||||
SSAFloat operator[](int index) const;
|
||||
static SSAVec4f insert_element(SSAVec4f vec4f, SSAFloat value, int index);
|
||||
static SSAVec4f bitcast(SSAVec4i i32);
|
||||
static SSAVec4f sqrt(SSAVec4f f);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
#include "r_compiler/llvm_include.h"
|
||||
#include "ssa_vec4f_ptr.h"
|
||||
#include "ssa_scope.h"
|
||||
#include "r_compiler/llvm_include.h"
|
||||
|
||||
SSAVec4fPtr::SSAVec4fPtr()
|
||||
: v(0)
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
|
||||
#include "r_compiler/llvm_include.h"
|
||||
#include "ssa_vec4i.h"
|
||||
#include "ssa_vec4f.h"
|
||||
#include "ssa_vec8s.h"
|
||||
#include "ssa_vec16ub.h"
|
||||
#include "ssa_int.h"
|
||||
#include "ssa_scope.h"
|
||||
#include "r_compiler/llvm_include.h"
|
||||
|
||||
SSAVec4i::SSAVec4i()
|
||||
: v(0)
|
||||
|
@ -67,11 +67,16 @@ SSAVec4i::SSAVec4i(SSAVec4f f32)
|
|||
v = SSAScope::builder().CreateCall(SSAScope::intrinsic(llvm::Intrinsic::x86_sse2_cvttps2dq), f32.v, SSAScope::hint());
|
||||
}
|
||||
|
||||
SSAInt SSAVec4i::operator[](SSAInt index)
|
||||
SSAInt SSAVec4i::operator[](SSAInt index) const
|
||||
{
|
||||
return SSAInt::from_llvm(SSAScope::builder().CreateExtractElement(v, index.v, SSAScope::hint()));
|
||||
}
|
||||
|
||||
SSAInt SSAVec4i::operator[](int index) const
|
||||
{
|
||||
return (*this)[SSAInt(index)];
|
||||
}
|
||||
|
||||
SSAVec4i SSAVec4i::insert(SSAInt index, SSAInt value)
|
||||
{
|
||||
return SSAVec4i::from_llvm(SSAScope::builder().CreateInsertElement(v, value.v, index.v, SSAScope::hint()));
|
||||
|
@ -82,6 +87,11 @@ SSAVec4i SSAVec4i::insert(int index, SSAInt value)
|
|||
return SSAVec4i::from_llvm(SSAScope::builder().CreateInsertElement(v, value.v, index, SSAScope::hint()));
|
||||
}
|
||||
|
||||
SSAVec4i SSAVec4i::insert(int index, int value)
|
||||
{
|
||||
return insert(index, SSAInt(value));
|
||||
}
|
||||
|
||||
llvm::Type *SSAVec4i::llvm_type()
|
||||
{
|
||||
return llvm::VectorType::get(llvm::Type::getInt32Ty(SSAScope::context()), 4);
|
||||
|
@ -125,12 +135,12 @@ void SSAVec4i::extend(SSAVec16ub a, SSAVec4i &out0, SSAVec4i &out1, SSAVec4i &ou
|
|||
|
||||
SSAVec4i SSAVec4i::extendhi(SSAVec8s i16)
|
||||
{
|
||||
return SSAVec4i::bitcast(SSAVec8s::shuffle(i16, 0, 4, 8+4, 5, 8+5, 6, 8+6, 7, 8+7)); // _mm_unpackhi_epi16
|
||||
return SSAVec4i::bitcast(SSAVec8s::shuffle(i16, SSAVec8s((short)0), 4, 8+4, 5, 8+5, 6, 8+6, 7, 8+7)); // _mm_unpackhi_epi16
|
||||
}
|
||||
|
||||
SSAVec4i SSAVec4i::extendlo(SSAVec8s i16)
|
||||
{
|
||||
return SSAVec4i::bitcast(SSAVec8s::shuffle(i16, 0, 0, 8+0, 1, 8+1, 2, 8+2, 3, 8+3)); // _mm_unpacklo_epi16
|
||||
return SSAVec4i::bitcast(SSAVec8s::shuffle(i16, SSAVec8s((short)0), 0, 8+0, 1, 8+1, 2, 8+2, 3, 8+3)); // _mm_unpacklo_epi16
|
||||
}
|
||||
|
||||
SSAVec4i SSAVec4i::combinehi(SSAVec8s a, SSAVec8s b)
|
||||
|
|
|
@ -13,15 +13,17 @@ class SSAVec4i
|
|||
{
|
||||
public:
|
||||
SSAVec4i();
|
||||
SSAVec4i(int constant);
|
||||
SSAVec4i(int constant0, int constant1, int constant2, int constant3);
|
||||
explicit SSAVec4i(int constant);
|
||||
explicit SSAVec4i(int constant0, int constant1, int constant2, int constant3);
|
||||
SSAVec4i(SSAInt i);
|
||||
SSAVec4i(SSAInt i0, SSAInt i1, SSAInt i2, SSAInt i3);
|
||||
explicit SSAVec4i(llvm::Value *v);
|
||||
SSAVec4i(SSAVec4f f32);
|
||||
SSAInt operator[](SSAInt index);
|
||||
SSAInt operator[](SSAInt index) const;
|
||||
SSAInt operator[](int index) const;
|
||||
SSAVec4i insert(SSAInt index, SSAInt value);
|
||||
SSAVec4i insert(int index, SSAInt value);
|
||||
SSAVec4i insert(int index, int value);
|
||||
static SSAVec4i bitcast(SSAVec4f f32);
|
||||
static SSAVec4i bitcast(SSAVec8s i16);
|
||||
static SSAVec4i shuffle(const SSAVec4i &f0, int index0, int index1, int index2, int index3);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
#include "r_compiler/llvm_include.h"
|
||||
#include "ssa_vec4i_ptr.h"
|
||||
#include "ssa_scope.h"
|
||||
#include "r_compiler/llvm_include.h"
|
||||
|
||||
SSAVec4iPtr::SSAVec4iPtr()
|
||||
: v(0)
|
||||
|
|
|
@ -15,6 +15,7 @@ public:
|
|||
static SSAVec4iPtr from_llvm(llvm::Value *v) { return SSAVec4iPtr(v); }
|
||||
static llvm::Type *llvm_type();
|
||||
SSAVec4iPtr operator[](SSAInt index) const;
|
||||
SSAVec4iPtr operator[](int index) const { return (*this)[SSAInt(index)]; }
|
||||
SSAVec4i load() const;
|
||||
SSAVec4i load_unaligned() const;
|
||||
void store(const SSAVec4i &new_value);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
#include "r_compiler/llvm_include.h"
|
||||
#include "ssa_vec8s.h"
|
||||
#include "ssa_vec4i.h"
|
||||
#include "ssa_vec16ub.h"
|
||||
#include "ssa_scope.h"
|
||||
#include "r_compiler/llvm_include.h"
|
||||
|
||||
SSAVec8s::SSAVec8s()
|
||||
: v(0)
|
||||
|
@ -77,12 +77,12 @@ SSAVec8s SSAVec8s::shuffle(const SSAVec8s &i0, const SSAVec8s &i1, int index0, i
|
|||
|
||||
SSAVec8s SSAVec8s::extendhi(SSAVec16ub a)
|
||||
{
|
||||
return SSAVec8s::bitcast(SSAVec16ub::shuffle(a, 0, 8, 16+8, 9, 16+9, 10, 16+10, 11, 16+11, 12, 16+12, 13, 16+13, 14, 16+14, 15, 16+15)); // _mm_unpackhi_epi8
|
||||
return SSAVec8s::bitcast(SSAVec16ub::shuffle(a, SSAVec16ub((unsigned char)0), 8, 16+8, 9, 16+9, 10, 16+10, 11, 16+11, 12, 16+12, 13, 16+13, 14, 16+14, 15, 16+15)); // _mm_unpackhi_epi8
|
||||
}
|
||||
|
||||
SSAVec8s SSAVec8s::extendlo(SSAVec16ub a)
|
||||
{
|
||||
return SSAVec8s::bitcast(SSAVec16ub::shuffle(a, 0, 0, 16+0, 1, 16+1, 2, 16+2, 3, 16+3, 4, 16+4, 5, 16+5, 6, 16+6, 7, 16+7)); // _mm_unpacklo_epi8
|
||||
return SSAVec8s::bitcast(SSAVec16ub::shuffle(a, SSAVec16ub((unsigned char)0), 0, 16+0, 1, 16+1, 2, 16+2, 3, 16+3, 4, 16+4, 5, 16+5, 6, 16+6, 7, 16+7)); // _mm_unpacklo_epi8
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -11,8 +11,8 @@ class SSAVec8s
|
|||
{
|
||||
public:
|
||||
SSAVec8s();
|
||||
SSAVec8s(short constant);
|
||||
SSAVec8s(short constant0, short constant1, short constant2, short constant3, short constant4, short constant5, short constant6, short constant7);
|
||||
explicit SSAVec8s(short constant);
|
||||
explicit SSAVec8s(short constant0, short constant1, short constant2, short constant3, short constant4, short constant5, short constant6, short constant7);
|
||||
explicit SSAVec8s(llvm::Value *v);
|
||||
SSAVec8s(SSAVec4i i0, SSAVec4i i1);
|
||||
static SSAVec8s bitcast(SSAVec16ub i8);
|
||||
|
|
Loading…
Reference in a new issue