# Question about SSE2 integer arithmetic

This topic is 3780 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hallo, I am working on converting a part of my code into SSE2 Intrinsics, but I have wondering about something. Is it not possible to multiply/divide/shift when working with 16 chars at the time? I have found the following commands for addition and subtraction, but nothing for mult/div/shift. _mm_add_epi8 _mm_sub_epi8 From what I can find the arithmetic operations I need is available if you work with 8 16bit intergers, but then I am wasting half the space in each SSE register.

##### Share on other sites
I'm a little confused regarding the number of bits you're trying to use, as you specified 16 char at one point. So I'm just going to list the allowed multiplication and shift functions (afaik, SSE2 doesn't have integer division available, you're going to have to use multiplication with a shift).

_mm_mulhi_epi16 (8 signed 16 bit from a * 8 signed 16-bit from b, packs upper 16 bits of 8 signed 32 result)
_mm_mulhi_epu16 (same as above, but unsigned)
_mm_mullo_epi16 (signed or unsigned, 16 bit int a * 16 bit int b, packs lower 16 of 32 bit result)
_mm_mul_su32 (multiplies lower 32 bit int a * lower 32 bit int b, returns 64 bit result)
_mm_mul_epu32(same as above, but unsigned)

All the shifts are listed here, so I'm not going to type them:
http://math.nju.edu.cn/help/mathhpc/doc/intel/cc/mergedProjects/intref_cls/common/intref_sse2_int_shift.htm

##### Share on other sites

What I ment is that I want to work with 16 8bit chars at the time. Sorry for not making it clear. But from your answare and from what I have found out myself, I am not sure its possible.

I know I can add/subtract them, but as there is no info about multiplication/division I assume its not possible to do so with 16 8bit chars at the same time.

Looks like I have to pad my data so I can work on 8 16bit chars instead, even though it means that can only work on half the data at the same time.

Thanks again

1. 1
Rutin
42
2. 2
3. 3
4. 4
5. 5

• 9
• 27
• 20
• 14
• 14
• ### Forum Statistics

• Total Topics
633387
• Total Posts
3011611
• ### Who's Online (See full list)

There are no registered users currently online

×