From ae3a0be92e33bc716722aa600983fc1535acb122 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 4 Jun 2009 22:49:04 +0000 Subject: Split the Add, Sub, and Mul instruction opcodes into separate integer and floating-point opcodes, introducing FAdd, FSub, and FMul. For now, the AsmParser, BitcodeReader, and IRBuilder all preserve backwards compatability, and the Core LLVM APIs preserve backwards compatibility for IR producers. Most front-ends won't need to change immediately. This implements the first step of the plan outlined here: http://nondot.org/sabre/LLVMNotes/IntegerOverflow.txt git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72897 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/LangRef.html | 135 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 117 insertions(+), 18 deletions(-) (limited to 'docs/LangRef.html') diff --git a/docs/LangRef.html b/docs/LangRef.html index 5f23674..60217ec 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -89,8 +89,11 @@
  • Binary Operations
    1. 'add' Instruction
    2. +
    3. 'fadd' Instruction
    4. 'sub' Instruction
    5. +
    6. 'fsub' Instruction
    7. 'mul' Instruction
    8. +
    9. 'fmul' Instruction
    10. 'udiv' Instruction
    11. 'sdiv' Instruction
    12. 'fdiv' Instruction
    13. @@ -2503,16 +2506,15 @@ The result value has the same type as its operands.

      Arguments:

      The two arguments to the 'add' instruction must be integer, floating point, or - vector values. Both arguments must have identical - types.

      + href="#t_integer">integer or + vector of integer values. Both arguments must + have identical types.

      Semantics:
      -

      The value produced is the integer or floating point sum of the two -operands.

      +

      The value produced is the integer sum of the two operands.

      -

      If an integer sum has unsigned overflow, the result returned is the +

      If the sum has unsigned overflow, the result returned is the mathematical result modulo 2n, where n is the bit width of the result.

      @@ -2527,6 +2529,39 @@ instruction is appropriate for both signed and unsigned integers.

      + +
      + +
      Syntax:
      + +
      +  <result> = fadd <ty> <op1>, <op2>   ; yields {ty}:result
      +
      + +
      Overview:
      + +

      The 'fadd' instruction returns the sum of its two operands.

      + +
      Arguments:
      + +

      The two arguments to the 'fadd' instruction must be +floating point or vector of +floating point values. Both arguments must have identical types.

      + +
      Semantics:
      + +

      The value produced is the floating point sum of the two operands.

      + +
      Example:
      + +
      +  <result> = fadd float 4.0, %var          ; yields {float}:result = 4.0 + %var
      +
      +
      + + @@ -2550,16 +2585,14 @@ representations.

      Arguments:

      The two arguments to the 'sub' instruction must be integer, floating point, - or vector values. Both arguments must have identical - types.

      + href="#t_integer">integer or vector of + integer values. Both arguments must have identical types.

      Semantics:
      -

      The value produced is the integer or floating point difference of -the two operands.

      +

      The value produced is the integer difference of the two operands.

      -

      If an integer difference has unsigned overflow, the result returned is the +

      If the difference has unsigned overflow, the result returned is the mathematical result modulo 2n, where n is the bit width of the result.

      @@ -2575,6 +2608,45 @@ instruction is appropriate for both signed and unsigned integers.

      + +
      + +
      Syntax:
      + +
      +  <result> = fsub <ty> <op1>, <op2>   ; yields {ty}:result
      +
      + +
      Overview:
      + +

      The 'fsub' instruction returns the difference of its two +operands.

      + +

      Note that the 'fsub' instruction is used to represent the +'fneg' instruction present in most other intermediate +representations.

      + +
      Arguments:
      + +

      The two arguments to the 'fsub' instruction must be floating point or vector + of floating point values. Both arguments must have identical types.

      + +
      Semantics:
      + +

      The value produced is the floating point difference of the two operands.

      + +
      Example:
      +
      +  <result> = fsub float 4.0, %var           ; yields {float}:result = 4.0 - %var
      +  <result> = fsub float -0.0, %val          ; yields {float}:result = -%var
      +
      +
      + + + @@ -2590,16 +2662,14 @@ operands.

      Arguments:

      The two arguments to the 'mul' instruction must be integer, floating point, -or vector values. Both arguments must have identical -types.

      +href="#t_integer">integer or vector of integer +values. Both arguments must have identical types.

      Semantics:
      -

      The value produced is the integer or floating point product of the -two operands.

      +

      The value produced is the integer product of the two operands.

      -

      If the result of an integer multiplication has unsigned overflow, +

      If the result of the multiplication has unsigned overflow, the result returned is the mathematical result modulo 2n, where n is the bit width of the result.

      Because LLVM integers use a two's complement representation, and the @@ -2614,6 +2684,35 @@ width of the full product.

      + + +
      + +
      Syntax:
      +
        <result> = fmul <ty> <op1>, <op2>   ; yields {ty}:result
      +
      +
      Overview:
      +

      The 'fmul' instruction returns the product of its two +operands.

      + +
      Arguments:
      + +

      The two arguments to the 'fmul' instruction must be +floating point or vector +of floating point values. Both arguments must have identical types.

      + +
      Semantics:
      + +

      The value produced is the floating point product of the two operands.

      + +
      Example:
      +
        <result> = fmul float 4.0, %var          ; yields {float}:result = 4.0 * %var
      +
      +
      + +
      -- cgit v1.1