Giter VIP home page Giter VIP logo

sse2msa's Introduction

sse2msa

A C/C++ header file that converts Intel SSE intrinsics to MIPS/MIPS64 MSA intrinsics.

Introduction

Inspired by sse2neon, sse2msa translates Intel SSE (Streaming SIMD Extensions) intrinsics to MIPS MSA.

Mapping and Coverage

Header file Extension
<mmintrin.h> MMX
<xmmintrin.h> SSE
<emmintrin.h> SSE2
<pmmintrin.h> SSE3
<tmmintrin.h> SSSE3
<smmintrin.h> SSE4.1
<nmmintrin.h> SSE4.2

sse2msa aims to support SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 extension.

Example

The header file sse2msa.h provides "SSE intrinsics" implemented with MSA intrinsics, on MIPS/MIPS64 targets, here's a example:

#include <stdio.h>

#if defined(__x86_64)
#include <xmmintrin.h>
#elif defined(__mips)
#include "sse2msa.h"
#endif

#define NELEM_F32 (sizeof(__m128) / sizeof(float))

int main()
{
	float out[NELEM_F32];
	__m128 a = _mm_set_ps1(1.0);
	_mm_storeu_ps(out, _mm_add_ps(a, a));
	for (int i = 0; i < NELEM_F32; ++i) {
		printf("%f\t", out[i]);
	}
	putc('\n', stdout);
	return 0;
}

On MIPS/MIPS64 targets, append the following compiler option:

  -mmsa

Related Projects

  • sse2neon: A C/C++ header file that converts Intel SSE intrinsics to Arm/Aarch64 NEON intrinsics.
  • SIMDe: Fast and portable implementations of SIMD intrinsics on hardware which doesn't natively support them, such as calling SSE functions on ARM.

Reference

Licensing

sse2msa is freely redistributable under the MIT License.

sse2msa's People

Contributors

i-evi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

laplacekorea

sse2msa's Issues

How to solve can't convert vector values between diferrent type

I'm trying to use your header file to run a SSE SIMD code on MIIPS CPU(Loongson 3A3000),it turns out with some errors.
error: can’t convert between vector values of different size
return vreinterpret_m128(__builtin_msa_fadd_w(vreinterpret_v4f32(a), vreinterpret_v4f32(b)));

error:can’t convert between vector values of different size
extension(({union {int32_t i; typeof(x) v;} $ = {.v = x}; $.i;}))

I don't know how to solve these problems, can you help me?
thank you so much.

Merge into SIMDe?

SIMDe maintainer here. If you're interested, I'd love to integrate this into SIMDe. Obviously SIMDe would benefit from better implementations on MSA. sse2msa would get vastly improved coverage of the x86 APIs from our existing portable fallbacks (which are often auto-vectorized) and an extensive test suite, and a lot of the work is already done (the functions already exist, adding MSA implementations is just a matter of adding the proper preprocessor test and calling the MSA function(s)).

We've actually already started implementing the MSA API using SSE/NEON/etc., so a lot of the infrastructure is already in place. To get things going in the other direction we would basically just need to add the MSA types to our existing SSE unions, which is quite simple.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.