Questions tagged [intrinsics]

Intrinsics are functions used in compiled languages to trigger the execution specific processor instructions, typically those outside the scope of the compiled language itself.

Intrinsic functions are pseudo-functions used by compilers to represent functionality that is outside the current scope of the language; often times, they may later be incorporated into a language. Some examples are simd and atomic instructions. The compiler has knowledge of the operations of the intrinsics and is able to optimize register use to take advantage of them.

A compiler library usually has actual implementations of the functions, which are used if a lower class CPU (or completely different) is detected at run-time or compile time.

Compiler intrinsics are very similar to inline-assembly. Inline assembler has notations to denote permissible input and output registers as well as clobber values; unless the compiler implicitly parses the inline assembly. With a compiler intrinsic, the register use is already built into the compiler and a developer doesn't need to know as many low level details; although it is often helpful to have some low level assembler knowledge to guide profiling and optimization.

Related tags:

1314 questions
-2
votes
1 answer

Why does inverting the parameters to a CMPGT comparison function work as a CMPLT?

I'm working with AVX2 in the process of optimizing a small mathematics library for a project, however, I've stumbled into minor inconsistencies. AVX2 lacks the support for a CMPLT function for packed 32b i's, which is unfortunate. An alternative…
user16520864
-2
votes
3 answers

How to convert this assembly code to intrinsic code?

Below it seems like intrinsics, however, I am not familiar with intrinsic functions. Please help me to convert the real code. Especially, testFunc() is more ambiguous for me. I guess it is also for dot product of two float vectors, but, the labels…
Seyon
  • 3
  • 2
-2
votes
1 answer

GPU intrinsics for OpenGL

Are there intrinsics/instructions on GPUs specific for the common operations of OpenGL/DirectX, such as triangle filling, texture mapping, clipping, etc? And if so, can they be accessed using OpenCL or CUDA code running on the GPU? Edit: I was…
tmlen
  • 8,533
  • 5
  • 31
  • 84
-2
votes
1 answer

Intel intrinsics assembly code

I am considering simple problem - speeding up the calculation of component-wise product of two arrays of doubles. I have noticed that using AVX commands I get only around 20% speedup, comparing to sequential multiplication in a loop. I decided to…
Tzoiker
  • 1,354
  • 1
  • 14
  • 23
-3
votes
2 answers

What is an example program that realizes a performance gain by calling _mm_stream_si64x()?

What is an example program that realizes a performance gain by calling _mm_stream_si64x()? The MSDN article on _mm_stream_si64x: http://msdn.microsoft.com/en-us/library/35b8kssy.aspx
Neil Justice
  • 1,325
  • 2
  • 12
  • 25
-5
votes
1 answer

How multiply convolutional core of 3x3 and an image

There is a convolutional core of 3x3 and an image represented by an array of pixels of integer values. A convolutional kernel is represented as follows: //compound convolutional kernels // | 1, 0, 1| // convolutional…
Georgy
  • 7
  • 1
-5
votes
1 answer

Fill with/without intrinsics C++

I'm studying intrinsic functions impact on performance, and I'm a little bit confused: they seem to have no impact at all! I'm trying to fill an array of doubles with two different functions and I see no differences. I allocated the array with a…
biagiop1986
  • 295
  • 4
  • 15
-10
votes
1 answer

Why do compilers not coerce "n / 2.0" into "n * 0.5" if it's faster?

I have always assumed that num * 0.5f and num / 2.0f were equivalent, since I thought the compiler was smart enough to optimize the division out. So today I decided to test that theory, and what I found out stumped me. Given the following sample…
1 2 3
87
88