llvm.org GIT mirror llvm / 9cdda8b
Merge 64066 from mainline. Document the 'llvm.OP.with.overflow' intrinsics. git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_25@65918 91177308-0d34-0410-b5e6-96231b3b80d8 Tanya Lattner 11 years ago
1 changed file(s) with 259 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
206206
  • 'llvm.part.set.*' Intrinsic
  • 207207
    208208
    209
  • Arithmetic with Overflow Intrinsics
  • 210
    211
  • 'llvm.sadd.with.overflow.* Intrinsics
  • 212
  • 'llvm.uadd.with.overflow.* Intrinsics
  • 213
  • 'llvm.ssub.with.overflow.* Intrinsics
  • 214
  • 'llvm.usub.with.overflow.* Intrinsics
  • 215
  • 'llvm.smul.with.overflow.* Intrinsics
  • 216
    217
    209218
  • Debugger intrinsics
  • 210219
  • Exception Handling intrinsics
  • 211220
  • Trampoline Intrinsic
  • 55725581

    This is an overloaded intrinsic. You can use llvm.ctpop on any integer bit

    55735582 width. Not all targets support all bit widths however.

    55745583
    
                      
                    
    5575 declare i8 @llvm.ctpop.i8 (i8 <src>)
    5584 declare i8 @llvm.ctpop.i8(i8 <src>)
    55765585 declare i16 @llvm.ctpop.i16(i16 <src>)
    55775586 declare i32 @llvm.ctpop.i32(i32 <src>)
    55785587 declare i64 @llvm.ctpop.i64(i64 <src>)
    57525761 with the replaced bits.

    57535762
    57545763
    Arguments:
    5755

    The first argument, %val and the result may be integer types of

    5756 any bit width but they must have the same bit width. %val is the value
    5764

    The first argument, %val, and the result may be integer types of

    5765 any bit width, but they must have the same bit width. %val is the value
    57575766 whose bits will be replaced. The second argument, %repl may be an
    57585767 integer of any bit width. The third and fourth arguments must be i32
    57595768 type since they specify only a bit index.

    57635772 of operation: forwards and reverse. If %lo is greater than
    57645773 %hi then the intrinsic operates in reverse mode. Otherwise it
    57655774 operates in forward mode.

    5775
    57665776

    For both modes, the %repl value is prepared for use by either

    57675777 truncating it down to the size of the replacement area or zero extending it
    57685778 up to that size.

    5779
    57695780

    In forward mode, the bits between %lo and %hi (inclusive)

    57705781 are replaced with corresponding bits from %repl. That is the 0th bit
    57715782 in %repl replaces the %loth bit in %val and etc. up
    57725783 to the %hith bit.

    5784
    57735785

    In reverse mode, a similar computation is made except that the bits are

    57745786 reversed. That is, the 0th bit in %repl replaces the
    57755787 %hi bit in %val and etc. down to the %loth bit.

    5788
    57765789
    Examples:
    5790
    57775791
    
                      
                    
    57785792 llvm.part.set(0xFFFF, 0, 4, 7) -> 0xFF0F
    57795793 llvm.part.set(0xFFFF, 0, 7, 4) -> 0xFF0F
    57815795 llvm.part.set(0xFFFF, F, 8, 3) -> 0xFFE7
    57825796 llvm.part.set(0xFFFF, 0, 3, 8) -> 0xFE07
    57835797
    5798
    5799
    5800
    5801
    5802
    5803 'llvm.sadd.with.overflow.*' Intrinsics
    5804
    5805
    5806
    5807
    5808
    Syntax:
    5809
    5810

    This is an overloaded intrinsic. You can use llvm.sadd.with.overflow

    5811 on any integer bit width. However, not all targets support all bit widths.

    5812
    5813
    
                      
                    
    5814 declare {i16, i1} @llvm.sadd.with.overflow.i16(i16 %a, i16 %b)
    5815 declare {i32, i1} @llvm.sadd.with.overflow.i32(i32 %a, i32 %b)
    5816 declare {i64, i1} @llvm.sadd.with.overflow.i64(i64 %a, i64 %b)
    5817
    5818
    5819
    Overview:
    5820
    5821

    The 'llvm.sadd.with.overflow' family of intrinsic functions perform

    5822 a signed addition of the two arguments, and indicate whether an overflow
    5823 occurred during the signed summation.

    5824
    5825
    Arguments:
    5826
    5827

    The arguments (%a and %b) and the first element of the result structure may

    5828 be of integer types of any bit width, but they must have the same bit width. The
    5829 second element of the result structure must be of type i1. %a
    5830 and %b are the two values that will undergo signed addition.

    5831
    5832
    Semantics:
    5833
    5834

    The 'llvm.sadd.with.overflow' family of intrinsic functions perform

    5835 a signed addition of the two variables. They return a structure — the
    5836 first element of which is the signed summation, and the second element of which
    5837 is a bit specifying if the signed summation resulted in an overflow.

    5838
    5839
    Examples:
    5840
    
                      
                    
    5841 %res = call {i32, i1} @llvm.sadd.with.overflow.i32(i32 %a, i32 %b)
    5842 %sum = extractvalue {i32, i1} %res, 0
    5843 %obit = extractvalue {i32, i1} %res, 1
    5844 br i1 %obit, label %overflow, label %normal
    5845
    5846
    5847
    5848
    5849
    5850
    5851 'llvm.uadd.with.overflow.*' Intrinsics
    5852
    5853
    5854
    5855
    5856
    Syntax:
    5857
    5858

    This is an overloaded intrinsic. You can use llvm.uadd.with.overflow

    5859 on any integer bit width. However, not all targets support all bit widths.

    5860
    5861
    
                      
                    
    5862 declare {i16, i1} @llvm.uadd.with.overflow.i16(i16 %a, i16 %b)
    5863 declare {i32, i1} @llvm.uadd.with.overflow.i32(i32 %a, i32 %b)
    5864 declare {i64, i1} @llvm.uadd.with.overflow.i64(i64 %a, i64 %b)
    5865
    5866
    5867
    Overview:
    5868
    5869

    The 'llvm.uadd.with.overflow' family of intrinsic functions perform

    5870 an unsigned addition of the two arguments, and indicate whether a carry occurred
    5871 during the unsigned summation.

    5872
    5873
    Arguments:
    5874
    5875

    The arguments (%a and %b) and the first element of the result structure may

    5876 be of integer types of any bit width, but they must have the same bit width. The
    5877 second element of the result structure must be of type i1. %a
    5878 and %b are the two values that will undergo unsigned addition.

    5879
    5880
    Semantics:
    5881
    5882

    The 'llvm.uadd.with.overflow' family of intrinsic functions perform

    5883 an unsigned addition of the two arguments. They return a structure — the
    5884 first element of which is the sum, and the second element of which is a bit
    5885 specifying if the unsigned summation resulted in a carry.

    5886
    5887
    Examples:
    5888
    
                      
                    
    5889 %res = call {i32, i1} @llvm.uadd.with.overflow.i32(i32 %a, i32 %b)
    5890 %sum = extractvalue {i32, i1} %res, 0
    5891 %obit = extractvalue {i32, i1} %res, 1
    5892 br i1 %obit, label %carry, label %normal
    5893
    5894
    5895
    5896
    5897
    5898
    5899 'llvm.ssub.with.overflow.*' Intrinsics
    5900
    5901
    5902
    5903
    5904
    Syntax:
    5905
    5906

    This is an overloaded intrinsic. You can use llvm.ssub.with.overflow

    5907 on any integer bit width. However, not all targets support all bit widths.

    5908
    5909
    
                      
                    
    5910 declare {i16, i1} @llvm.ssub.with.overflow.i16(i16 %a, i16 %b)
    5911 declare {i32, i1} @llvm.ssub.with.overflow.i32(i32 %a, i32 %b)
    5912 declare {i64, i1} @llvm.ssub.with.overflow.i64(i64 %a, i64 %b)
    5913
    5914
    5915
    Overview:
    5916
    5917

    The 'llvm.ssub.with.overflow' family of intrinsic functions perform

    5918 a signed subtraction of the two arguments, and indicate whether an overflow
    5919 occurred during the signed subtraction.

    5920
    5921
    Arguments:
    5922
    5923

    The arguments (%a and %b) and the first element of the result structure may

    5924 be of integer types of any bit width, but they must have the same bit width. The
    5925 second element of the result structure must be of type i1. %a
    5926 and %b are the two values that will undergo signed subtraction.

    5927
    5928
    Semantics:
    5929
    5930

    The 'llvm.ssub.with.overflow' family of intrinsic functions perform

    5931 a signed subtraction of the two arguments. They return a structure — the
    5932 first element of which is the subtraction, and the second element of which is a bit
    5933 specifying if the signed subtraction resulted in an overflow.

    5934
    5935
    Examples:
    5936
    
                      
                    
    5937 %res = call {i32, i1} @llvm.ssub.with.overflow.i32(i32 %a, i32 %b)
    5938 %sum = extractvalue {i32, i1} %res, 0
    5939 %obit = extractvalue {i32, i1} %res, 1
    5940 br i1 %obit, label %overflow, label %normal
    5941
    5942
    5943
    5944
    5945
    5946
    5947 'llvm.usub.with.overflow.*' Intrinsics
    5948
    5949
    5950
    5951
    5952
    Syntax:
    5953
    5954

    This is an overloaded intrinsic. You can use llvm.usub.with.overflow

    5955 on any integer bit width. However, not all targets support all bit widths.

    5956
    5957
    
                      
                    
    5958 declare {i16, i1} @llvm.usub.with.overflow.i16(i16 %a, i16 %b)
    5959 declare {i32, i1} @llvm.usub.with.overflow.i32(i32 %a, i32 %b)
    5960 declare {i64, i1} @llvm.usub.with.overflow.i64(i64 %a, i64 %b)
    5961
    5962
    5963
    Overview:
    5964
    5965

    The 'llvm.usub.with.overflow' family of intrinsic functions perform

    5966 an unsigned subtraction of the two arguments, and indicate whether an overflow
    5967 occurred during the unsigned subtraction.

    5968
    5969
    Arguments:
    5970
    5971

    The arguments (%a and %b) and the first element of the result structure may

    5972 be of integer types of any bit width, but they must have the same bit width. The
    5973 second element of the result structure must be of type i1. %a
    5974 and %b are the two values that will undergo unsigned subtraction.

    5975
    5976
    Semantics:
    5977
    5978

    The 'llvm.usub.with.overflow' family of intrinsic functions perform

    5979 an unsigned subtraction of the two arguments. They return a structure — the
    5980 first element of which is the subtraction, and the second element of which is a bit
    5981 specifying if the unsigned subtraction resulted in an overflow.

    5982
    5983
    Examples:
    5984
    
                      
                    
    5985 %res = call {i32, i1} @llvm.usub.with.overflow.i32(i32 %a, i32 %b)
    5986 %sum = extractvalue {i32, i1} %res, 0
    5987 %obit = extractvalue {i32, i1} %res, 1
    5988 br i1 %obit, label %overflow, label %normal
    5989
    5990
    5991
    5992
    5993
    5994
    5995 'llvm.smul.with.overflow.*' Intrinsics
    5996
    5997
    5998
    5999
    6000
    Syntax:
    6001
    6002

    This is an overloaded intrinsic. You can use llvm.smul.with.overflow

    6003 on any integer bit width. However, not all targets support all bit widths.

    6004
    6005
    
                      
                    
    6006 declare {i16, i1} @llvm.smul.with.overflow.i16(i16 %a, i16 %b)
    6007 declare {i32, i1} @llvm.smul.with.overflow.i32(i32 %a, i32 %b)
    6008 declare {i64, i1} @llvm.smul.with.overflow.i64(i64 %a, i64 %b)
    6009
    6010
    6011
    Overview:
    6012
    6013

    The 'llvm.smul.with.overflow' family of intrinsic functions perform

    6014 a signed multiplication of the two arguments, and indicate whether an overflow
    6015 occurred during the signed multiplication.

    6016
    6017
    Arguments:
    6018
    6019

    The arguments (%a and %b) and the first element of the result structure may

    6020 be of integer types of any bit width, but they must have the same bit width. The
    6021 second element of the result structure must be of type i1. %a
    6022 and %b are the two values that will undergo signed multiplication.

    6023
    6024
    Semantics:
    6025
    6026

    The 'llvm.smul.with.overflow' family of intrinsic functions perform

    6027 a signed multiplication of the two arguments. They return a structure —
    6028 the first element of which is the multiplication, and the second element of
    6029 which is a bit specifying if the signed multiplication resulted in an
    6030 overflow.

    6031
    6032
    Examples:
    6033
    
                      
                    
    6034 %res = call {i32, i1} @llvm.smul.with.overflow.i32(i32 %a, i32 %b)
    6035 %sum = extractvalue {i32, i1} %res, 0
    6036 %obit = extractvalue {i32, i1} %res, 1
    6037 br i1 %obit, label %overflow, label %normal
    6038
    6039
    57846040
    57856041
    57866042