Skip to content

Commit 2dbae3b

Browse files
TellowKrinklelightningterror
authored andcommitted
Misc: Fix GCC arm linux build
1 parent fa26937 commit 2dbae3b

7 files changed

Lines changed: 40 additions & 38 deletions

File tree

pcsx2/GS/GSVector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ __forceinline_odr GSVector4i::GSVector4i(const GSVector4& v, bool truncate)
116116
m = truncate ? _mm_cvttps_epi32(v) : _mm_cvtps_epi32(v);
117117
#elif defined(ARCH_ARM64)
118118
// GS thread uses default (nearest) rounding.
119-
v4s = truncate ? vcvtq_s32_f32(v.v4s) : vcvtnq_u32_f32(v.v4s);
119+
v4s = truncate ? vcvtq_s32_f32(v.v4s) : vreinterpretq_s32_u32(vcvtnq_u32_f32(v.v4s));
120120
#endif
121121
}
122122

pcsx2/GS/GSVector4_arm64.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -703,17 +703,17 @@ class alignas(16) GSVector4
703703

704704
__forceinline GSVector4 mul64(const GSVector4& v) const
705705
{
706-
return GSVector4(vmulq_f64(vreinterpretq_f64_f32(v4s), vreinterpretq_f64_f32(v.v4s)));
706+
return GSVector4(vreinterpretq_f32_f64(vmulq_f64(vreinterpretq_f64_f32(v4s), vreinterpretq_f64_f32(v.v4s))));
707707
}
708708

709709
__forceinline GSVector4 add64(const GSVector4& v) const
710710
{
711-
return GSVector4(vaddq_f64(vreinterpretq_f64_f32(v4s), vreinterpretq_f64_f32(v.v4s)));
711+
return GSVector4(vreinterpretq_f32_f64(vaddq_f64(vreinterpretq_f64_f32(v4s), vreinterpretq_f64_f32(v.v4s))));
712712
}
713713

714714
__forceinline GSVector4 sub64(const GSVector4& v) const
715715
{
716-
return GSVector4(vsubq_f64(vreinterpretq_f64_f32(v4s), vreinterpretq_f64_f32(v.v4s)));
716+
return GSVector4(vreinterpretq_f32_f64(vsubq_f64(vreinterpretq_f64_f32(v4s), vreinterpretq_f64_f32(v.v4s))));
717717
}
718718

719719
__forceinline static GSVector4 f32to64(const GSVector4& v)
@@ -728,10 +728,8 @@ class alignas(16) GSVector4
728728

729729
__forceinline GSVector4i f64toi32(bool truncate = true) const
730730
{
731-
const float64x2_t r = truncate ? v4s : vrndiq_f64(vreinterpretq_f64_f32(v4s));
732-
const s32 low = static_cast<s32>(vgetq_lane_f64(r, 0));
733-
const s32 high = static_cast<s32>(vgetq_lane_f64(r, 1));
734-
return GSVector4i(vsetq_lane_s32(high, vsetq_lane_s32(low, vdupq_n_s32(0), 0), 1));
731+
const int64x2_t r = truncate ? vcvtq_s64_f64(vreinterpretq_f64_f32(v4s)) : vcvtnq_s64_f64(vreinterpretq_f64_f32(v4s));
732+
return GSVector4i(vcombine_s32(vmovn_s64(r), vdup_n_s32(0)));
735733
}
736734

737735
// clang-format off
@@ -782,6 +780,6 @@ class alignas(16) GSVector4
782780

783781
__forceinline static GSVector4 broadcast64(const void* f)
784782
{
785-
return GSVector4(vreinterpretq_f64_f32(vld1q_dup_f64((const double*)f)));
783+
return GSVector4(vreinterpretq_f32_f64(vld1q_dup_f64((const double*)f)));
786784
}
787785
};

pcsx2/GS/GSVector4i_arm64.h

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ class alignas(16) GSVector4i
373373

374374
__forceinline u32 minv_u32() const
375375
{
376-
return vminvq_u32(v4s);
376+
return vminvq_u32(vreinterpretq_u32_s32(v4s));
377377
}
378378

379379
__forceinline u32 maxv_s32() const
@@ -383,7 +383,7 @@ class alignas(16) GSVector4i
383383

384384
__forceinline u32 maxv_u32() const
385385
{
386-
return vmaxvq_u32(v4s);
386+
return vmaxvq_u32(vreinterpretq_u32_s32(v4s));
387387
}
388388

389389
__forceinline static int min_i16(int a, int b)
@@ -508,12 +508,12 @@ class alignas(16) GSVector4i
508508

509509
__forceinline GSVector4i pkl32(const GSVector4i& a) const
510510
{
511-
return GSVector4i(vuzp1q_u32(v4s, a.v4s));
511+
return GSVector4i(vuzp1q_s32(v4s, a.v4s));
512512
}
513513

514514
__forceinline GSVector4i pku32(const GSVector4i& a) const
515515
{
516-
return GSVector4i(vuzp2q_u32(v4s, a.v4s));
516+
return GSVector4i(vuzp2q_s32(v4s, a.v4s));
517517
}
518518

519519
__forceinline GSVector4i upl8(const GSVector4i& a) const
@@ -701,7 +701,7 @@ class alignas(16) GSVector4i
701701

702702
__forceinline GSVector4i srl16(s32 i) const
703703
{
704-
return GSVector4i(vreinterpretq_s32_u16(vshlq_u16(vreinterpretq_u16_s32(v4s), vdupq_n_u16(-i))));
704+
return GSVector4i(vreinterpretq_s32_u16(vshlq_u16(vreinterpretq_u16_s32(v4s), vdupq_n_s16(-i))));
705705
}
706706

707707
__forceinline GSVector4i srlv16(const GSVector4i& v) const
@@ -764,7 +764,7 @@ class alignas(16) GSVector4i
764764

765765
__forceinline GSVector4i srav32(const GSVector4i& v) const
766766
{
767-
return GSVector4i(vshlq_s32(vreinterpretq_u32_s32(v4s), vnegq_s32(v.v4s)));
767+
return GSVector4i(vshlq_s32(v4s, vnegq_s32(v.v4s)));
768768
}
769769

770770
template <int i>
@@ -775,7 +775,7 @@ class alignas(16) GSVector4i
775775

776776
__forceinline GSVector4i sll64(s32 i) const
777777
{
778-
return GSVector4i(vreinterpretq_s32_s64(vshlq_s64(vreinterpretq_s64_s32(v4s), vdupq_n_s16(i))));
778+
return GSVector4i(vreinterpretq_s32_s64(vshlq_s64(vreinterpretq_s64_s32(v4s), vdupq_n_s64(i))));
779779
}
780780

781781
__forceinline GSVector4i sllv64(const GSVector4i& v) const
@@ -791,7 +791,7 @@ class alignas(16) GSVector4i
791791

792792
__forceinline GSVector4i sra64(s32 i) const
793793
{
794-
return GSVector4i(vreinterpretq_s32_s64(vshlq_s64(vreinterpretq_s64_s32(v4s), vdupq_n_s16(-i))));
794+
return GSVector4i(vreinterpretq_s32_s64(vshlq_s64(vreinterpretq_s64_s32(v4s), vdupq_n_s64(-i))));
795795
}
796796

797797
__forceinline GSVector4i srav64(const GSVector4i& v) const
@@ -808,7 +808,7 @@ class alignas(16) GSVector4i
808808

809809
__forceinline GSVector4i srl64(s32 i) const
810810
{
811-
return GSVector4i(vreinterpretq_s32_u64(vshlq_u64(vreinterpretq_u64_s32(v4s), vdupq_n_u16(-i))));
811+
return GSVector4i(vreinterpretq_s32_u64(vshlq_u64(vreinterpretq_u64_s32(v4s), vdupq_n_s64(-i))));
812812
}
813813

814814
__forceinline GSVector4i srlv64(const GSVector4i& v) const
@@ -858,7 +858,7 @@ class alignas(16) GSVector4i
858858
//return GSVector4i(vreinterpretq_s32_s16(vpaddq_s16(vreinterpretq_s16_s32(v4s), vreinterpretq_s16_s32(v.v4s))));
859859
const int16x8_t a = vreinterpretq_s16_s32(v4s);
860860
const int16x8_t b = vreinterpretq_s16_s32(v.v4s);
861-
return GSVector4i(vqaddq_s16(vuzp1q_s16(a, b), vuzp2q_s16(a, b)));
861+
return GSVector4i(vreinterpretq_s32_s16(vqaddq_s16(vuzp1q_s16(a, b), vuzp2q_s16(a, b))));
862862
}
863863

864864
__forceinline GSVector4i addus8(const GSVector4i& v) const
@@ -888,7 +888,7 @@ class alignas(16) GSVector4i
888888

889889
__forceinline GSVector4i hsub32(const GSVector4i& v) const
890890
{
891-
return GSVector4i(vsubq_u32(vuzp1q_u32(v4s, v.v4s), vuzp2q_u32(v4s, v.v4s)));
891+
return GSVector4i(vsubq_s32(vuzp1q_s32(v4s, v.v4s), vuzp2q_s32(v4s, v.v4s)));
892892
}
893893

894894
__forceinline GSVector4i subs8(const GSVector4i& v) const
@@ -1029,62 +1029,62 @@ class alignas(16) GSVector4i
10291029

10301030
__forceinline GSVector4i gt8(const GSVector4i& v) const
10311031
{
1032-
return GSVector4i(vreinterpretq_s32_s8(vcgtq_s8(vreinterpretq_s8_s32(v4s), vreinterpretq_s8_s32(v.v4s))));
1032+
return GSVector4i(vreinterpretq_s32_u8(vcgtq_s8(vreinterpretq_s8_s32(v4s), vreinterpretq_s8_s32(v.v4s))));
10331033
}
10341034

10351035
__forceinline GSVector4i gt16(const GSVector4i& v) const
10361036
{
1037-
return GSVector4i(vreinterpretq_s32_s16(vcgtq_s16(vreinterpretq_s16_s32(v4s), vreinterpretq_s16_s32(v.v4s))));
1037+
return GSVector4i(vreinterpretq_s32_u16(vcgtq_s16(vreinterpretq_s16_s32(v4s), vreinterpretq_s16_s32(v.v4s))));
10381038
}
10391039

10401040
__forceinline GSVector4i gt32(const GSVector4i& v) const
10411041
{
1042-
return GSVector4i(vcgtq_s32(v4s, v.v4s));
1042+
return GSVector4i(vreinterpretq_s32_u32(vcgtq_s32(v4s, v.v4s)));
10431043
}
10441044

10451045
__forceinline GSVector4i ge8(const GSVector4i& v) const
10461046
{
1047-
return GSVector4i(vreinterpretq_s32_s8(vcgeq_s8(vreinterpretq_s8_s32(v4s), vreinterpretq_s8_s32(v.v4s))));
1047+
return GSVector4i(vreinterpretq_s32_u8(vcgeq_s8(vreinterpretq_s8_s32(v4s), vreinterpretq_s8_s32(v.v4s))));
10481048
}
10491049

10501050
__forceinline GSVector4i ge16(const GSVector4i& v) const
10511051
{
1052-
return GSVector4i(vreinterpretq_s32_s16(vcgeq_s16(vreinterpretq_s16_s32(v4s), vreinterpretq_s16_s32(v.v4s))));
1052+
return GSVector4i(vreinterpretq_s32_u16(vcgeq_s16(vreinterpretq_s16_s32(v4s), vreinterpretq_s16_s32(v.v4s))));
10531053
}
10541054

10551055
__forceinline GSVector4i ge32(const GSVector4i& v) const
10561056
{
1057-
return GSVector4i(vcgeq_s32(v4s, v.v4s));
1057+
return GSVector4i(vreinterpretq_s32_u32(vcgeq_s32(v4s, v.v4s)));
10581058
}
10591059

10601060
__forceinline GSVector4i lt8(const GSVector4i& v) const
10611061
{
1062-
return GSVector4i(vreinterpretq_s32_s8(vcltq_s8(vreinterpretq_s8_s32(v4s), vreinterpretq_s8_s32(v.v4s))));
1062+
return GSVector4i(vreinterpretq_s32_u8(vcltq_s8(vreinterpretq_s8_s32(v4s), vreinterpretq_s8_s32(v.v4s))));
10631063
}
10641064

10651065
__forceinline GSVector4i lt16(const GSVector4i& v) const
10661066
{
1067-
return GSVector4i(vreinterpretq_s32_s16(vcltq_s16(vreinterpretq_s16_s32(v4s), vreinterpretq_s16_s32(v.v4s))));
1067+
return GSVector4i(vreinterpretq_s32_u16(vcltq_s16(vreinterpretq_s16_s32(v4s), vreinterpretq_s16_s32(v.v4s))));
10681068
}
10691069

10701070
__forceinline GSVector4i lt32(const GSVector4i& v) const
10711071
{
1072-
return GSVector4i(vcltq_s32(v4s, v.v4s));
1072+
return GSVector4i(vreinterpretq_s32_u32(vcltq_s32(v4s, v.v4s)));
10731073
}
10741074

10751075
__forceinline GSVector4i le8(const GSVector4i& v) const
10761076
{
1077-
return GSVector4i(vreinterpretq_s32_s8(vcleq_s8(vreinterpretq_s8_s32(v4s), vreinterpretq_s8_s32(v.v4s))));
1077+
return GSVector4i(vreinterpretq_s32_u8(vcleq_s8(vreinterpretq_s8_s32(v4s), vreinterpretq_s8_s32(v.v4s))));
10781078
}
10791079

10801080
__forceinline GSVector4i le16(const GSVector4i& v) const
10811081
{
1082-
return GSVector4i(vreinterpretq_s32_s16(vcleq_s16(vreinterpretq_s16_s32(v4s), vreinterpretq_s16_s32(v.v4s))));
1082+
return GSVector4i(vreinterpretq_s32_u16(vcleq_s16(vreinterpretq_s16_s32(v4s), vreinterpretq_s16_s32(v.v4s))));
10831083
}
10841084

10851085
__forceinline GSVector4i le32(const GSVector4i& v) const
10861086
{
1087-
return GSVector4i(vcleq_s32(v4s, v.v4s));
1087+
return GSVector4i(vreinterpretq_s32_u32(vcleq_s32(v4s, v.v4s)));
10881088
}
10891089

10901090

@@ -1112,7 +1112,7 @@ class alignas(16) GSVector4i
11121112
__forceinline bool allfalse() const
11131113
{
11141114
// MSB should be clear in all 8-bit lanes.
1115-
return (vmaxvq_u32(vreinterpretq_u8_s32(v4s)) & 0x80) != 0x80;
1115+
return (vmaxvq_u8(vreinterpretq_u8_s32(v4s)) & 0x80) != 0x80;
11161116
}
11171117

11181118
template <int i>

pcsx2/GS/Renderers/SW/GSDrawScanlineCodeGenerator.arm64.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ static const auto& _d4_f = v9;
7777
static const auto& _test = v8;
7878
static const auto& _fd = v2;
7979

80-
#define _local(field) MemOperand(_locals, offsetof(GSScanlineLocalData, field))
81-
#define _global(field) MemOperand(_globals, offsetof(GSScanlineGlobalData, field))
80+
// Yay, you can't offsetof with non-constant array indices in GCC
81+
#define OFFSETOF(base, field) (reinterpret_cast<uptr>(&reinterpret_cast<base*>(0)->field))
82+
#define _local(field) MemOperand(_locals, OFFSETOF(GSScanlineLocalData, field))
83+
#define _global(field) MemOperand(_globals, OFFSETOF(GSScanlineGlobalData, field))
8284
#define armAsm (&m_emitter)
8385

8486
GSDrawScanlineCodeGenerator::GSDrawScanlineCodeGenerator(u64 key, void* code, size_t maxsize)

pcsx2/GS/Renderers/SW/GSSetupPrimCodeGenerator.arm64.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ static const auto& _vscratch = v31;
2222

2323
static constexpr const GSScanlineConstantData128B& g_const = g_const_128b;
2424

25-
#define _local(field) MemOperand(_locals, offsetof(GSScanlineLocalData, field))
25+
// Yay, you can't offsetof with non-constant array indices in GCC
26+
#define OFFSETOF(base, field) (reinterpret_cast<uptr>(&reinterpret_cast<base*>(0)->field))
27+
#define _local(field) MemOperand(_locals, OFFSETOF(GSScanlineLocalData, field))
2628
#define armAsm (&m_emitter)
2729

2830
GSSetupPrimCodeGenerator::GSSetupPrimCodeGenerator(u64 key, void* code, size_t maxsize)

pcsx2/Gif_Unit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ struct Gif_Tag
123123
u64 REGS64;
124124
std::memcpy(&REGS64, tag.REGS, sizeof(u64));
125125
REGS64 &= (0xFFFFFFFFFFFFFFFFULL >> (64 - nRegs * 4));
126-
uint8x16_t vregs = vsetq_lane_u64(REGS64, vdupq_n_u64(0), 0);
126+
uint8x16_t vregs = vreinterpretq_u8_u64(vsetq_lane_u64(REGS64, vdupq_n_u64(0), 0));
127127

128128
// get upper nibbles, interleave with lower nibbles, clear upper bits from low nibbles
129129
vregs = vandq_u8(vzip1q_u8(vregs, vshrq_n_u8(vregs, 4)), vdupq_n_u8(0x0F));

pcsx2/ImGui/ImGuiFullscreen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2717,7 +2717,7 @@ void ImGuiFullscreen::DrawInputDialog()
27172717

27182718
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + LayoutScale(10.0f));
27192719

2720-
static auto input_callback = [](ImGuiInputTextCallbackData* data) -> int {
2720+
static const ImGuiInputTextCallback input_callback = [](ImGuiInputTextCallbackData* data) -> int {
27212721
InputFilterType* filter_type = static_cast<InputFilterType*>(data->UserData);
27222722

27232723
if (data->EventFlag == ImGuiInputTextFlags_CallbackCharFilter) {

0 commit comments

Comments
 (0)