Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ppu: improve lvebx/lvehx/lvewx instructions #5112

Merged
merged 1 commit into from Sep 11, 2018
Merged

ppu: improve lvebx/lvehx/lvewx instructions #5112

merged 1 commit into from Sep 11, 2018

Conversation

scribam
Copy link
Contributor

@scribam scribam commented Sep 11, 2018

screenshot from 2018-09-11 18-55-42

Test:

#include <stdio.h>
#include <math.h>
#include <float.h>
#include <altivec.h>
#include <ppu_intrinsics.h>

#define PRINT_VECTOR(v0)  printf("%08x %08x %08x %08x\n", ((vec_int4)v0)[0], ((vec_int4)v0)[1], ((vec_int4)v0)[2], ((vec_int4)v0)[3]);

int main(void)
{
	unsigned char srcUChars[16]   = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
	unsigned short srcUShorts[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
	unsigned int srcUInts[16]     = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};

	// Vector Load Instructions
	for (int i = 0; i < 16; i++)
	{
		printf("vec_lvebx  (%d, srcUChars)  -> ", i); PRINT_VECTOR(vec_lvebx(i, srcUChars));
		printf("vec_lvehx  (%d, srcUShorts) -> ", i); PRINT_VECTOR(vec_lvehx(i, srcUShorts));
		printf("vec_lvewx  (%d, srcUInts)   -> ", i); PRINT_VECTOR(vec_lvewx(i, srcUInts));
		printf("vec_lvx    (%d, srcUInts)   -> ", i); PRINT_VECTOR(vec_lvx(i, srcUInts));
	}

	return 0;
}

SetVr(op.vd, m_ir->CreateInsertElement(ConstantVector::getSplat(16, m_ir->getInt8(0)), ReadMemory(addr, GetType<u8>()), pos));
const auto addr = m_ir->CreateAnd(op.ra ? m_ir->CreateAdd(GetGpr(op.ra), GetGpr(op.rb)) : GetGpr(op.rb), ~0xfull);
const auto data = ReadMemory(addr, GetType<u8[16]>(), m_is_be, 16);
SetVr(op.vd, m_is_be ? data : Shuffle(data, nullptr, { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could write return LVX(op); then if they are supposed to be identical, the same applies to the interpreter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Nekotekina Nekotekina merged commit f294729 into RPCS3:master Sep 11, 2018
@scribam scribam deleted the lvebx-lvehx-lvewx branch September 11, 2018 18:21
@AniLeo
Copy link
Member

AniLeo commented Sep 11, 2018

Don't spam the tracker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants