- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I've got the following datatype:
struct X { __m128i hi; __m128i lo; }
I need to use only SSE 4.2 and below instructions to do a subtraction of 2 of these taking into account possible borrow issues at bits 63-64, 127-128 and 191-192. Does anyone have a quick set of instructions that could be used to accomplish this? Again using SSE 4.2 and earlier instructions.
Thx...
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
garfield-lewis wrote:Hi,
I've got the following datatype:
struct X { __m128i hi; __m128i lo; }
I need to use only SSE 4.2 and below instructions to do a subtraction of 2 of these taking into account possible borrow issues at bits 63-64, 127-128 and 191-192. Does anyone have a quick set of instructions that could be used to accomplish this? Again using SSE 4.2 and earlier instructions.
Thx...
The best solution is to break components of X into scalars:
[cpp] asm ("sub %4, %0;" "sbb %5, %1;" "sbb %6, %2;" "sbb %7, %3;" : "=r" (*(uint64*) &z.lo), "=r" (*((uint64*) &z.lo + 1)), "=r" (*(uint64*) &z.hi), "=r" (*((uint64*) &z.hi + 1)) : "g" (*(uint64*) &y.lo), "g" (*((uint64*) &y.lo + 1)), "g" (*(uint64*) &y.hi), "g" (*((uint64*) &y.hi + 1)), "0" (*(uint64*) &x.lo), "1" (*((uint64*) &x.lo + 1)), "2" (*(uint64*) &x.hi), "3" (*((uint64*) &x.hi + 1)) );[/cpp]
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page