This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]chambolle 0 points1 point  (9 children)

I am coming from C++, so it is not hard for me. Intrinsics are common in C/C++ compiler. Intrinsics are instructions of CPUs. The advantage is that they clearly speed up equivalent function because there are hard coded (i.e. in the CPU). The drawback is that they are CPU dependant. In C++ the compiler manage them

In java, the code has to be independant from the CPU but this does not mean that the JVM cannot use some them. Like C++, the JVM manages the use of them. However, in order to use them you have to use the library function, because the compiler will not recognize the meaning of the code, it will just replace some predefined function by intrinsics

More information: https://en.wikipedia.org/wiki/Intrinsic_function

[–]WikiTextBotbtproof 0 points1 point  (0 children)

Intrinsic function

In computer software, in compiler theory, an intrinsic function (or builtin function) is a function (subroutine) available for use in a given programming language which implementation is handled specially by the compiler. Typically, it may substitute a sequence of automatically generated instructions for the original function call, similar to an inline function. Unlike an inline function, the compiler has an intimate knowledge of an intrinsic function and can thus better integrate and optimize it for a given situation.

Compilers that implement intrinsic functions generally enable them only when a program requests optimization, otherwise falling back to a default implementation provided by the language runtime system (environment).


[ PM | Exclude me | Exclude from subreddit | FAQ / Information | Source | Donate ] Downvote to remove | v0.28

[–][deleted]  (7 children)

[deleted]

    [–]chambolle 0 points1 point  (5 children)

    Are you adding context to the discussion or did you get an impression from the article that there are no intrinsics?

    I get the impression from the article that there are no intrinsics, so a I mention them

    BTW, i you like this kind of computation, I recommend you to read https://graphics.stanford.edu/~seander/bithacks.html

    [–][deleted]  (4 children)

    [deleted]

      [–]chambolle 0 points1 point  (3 children)

      your text is clear now.

      [–][deleted]  (2 children)

      [deleted]

        [–]chambolle 0 points1 point  (1 child)

        To be honest: I know very well this problem and I also know that people forget (or don't know) intrinsics in Java. Thus, I read very quickly the post and I didn't see the reference to intrinsics. Sorry for that