From: Bill Wendling This is an overloaded intrinsic. You can use llvm.ctpop on any integer bit
width. Not all targets support all bit widths however.
- declare i8 @llvm.ctpop.i8 (i8 <src>)
+ declare i8 @llvm.ctpop.i8(i8 <src>)
declare i16 @llvm.ctpop.i16(i16 <src>)
declare i32 @llvm.ctpop.i32(i32 <src>)
declare i64 @llvm.ctpop.i64(i64 <src>)
@@ -5867,8 +5876,8 @@ of bits in an integer value with another integer value. It returns the integer
with the replaced bits.
The first argument, %val and the result may be integer types of -any bit width but they must have the same bit width. %val is the value +
The first argument, %val, and the result may be integer types of +any bit width, but they must have the same bit width. %val is the value whose bits will be replaced. The second argument, %repl may be an integer of any bit width. The third and fourth arguments must be i32 type since they specify only a bit index.
@@ -5878,17 +5887,22 @@ type since they specify only a bit index. of operation: forwards and reverse. If %lo is greater than %hi then the intrinsic operates in reverse mode. Otherwise it operates in forward mode. +For both modes, the %repl value is prepared for use by either truncating it down to the size of the replacement area or zero extending it up to that size.
+In forward mode, the bits between %lo and %hi (inclusive) are replaced with corresponding bits from %repl. That is the 0th bit in %repl replaces the %loth bit in %val and etc. up to the %hith bit.
+In reverse mode, a similar computation is made except that the bits are reversed. That is, the 0th bit in %repl replaces the %hi bit in %val and etc. down to the %loth bit.
+llvm.part.set(0xFFFF, 0, 4, 7) -> 0xFF0F llvm.part.set(0xFFFF, 0, 7, 4) -> 0xFF0F @@ -5896,6 +5910,248 @@ reversed. That is, the 0th bit in %repl replaces the llvm.part.set(0xFFFF, F, 8, 3) -> 0xFFE7 llvm.part.set(0xFFFF, 0, 3, 8) -> 0xFE07+ + + + + + +
This is an overloaded intrinsic. You can use llvm.sadd.with.overflow +on any integer bit width. However, not all targets support all bit widths.
+ ++ declare {i16, i1} @llvm.sadd.with.overflow.i16(i16 %a, i16 %b) + declare {i32, i1} @llvm.sadd.with.overflow.i32(i32 %a, i32 %b) + declare {i64, i1} @llvm.sadd.with.overflow.i64(i64 %a, i64 %b) ++ +
The 'llvm.sadd.with.overflow' family of intrinsic functions perform +a signed addition of the two arguments, and indicate whether an overflow +occurred during the signed summation.
+ +The arguments (%a and %b) and the first element of the result structure may +be of integer types of any bit width, but they must have the same bit width. The +second element of the result structure must be of type i1. %a +and %b are the two values that will undergo signed addition.
+ +The 'llvm.sadd.with.overflow' family of intrinsic functions perform +a signed addition of the two variables. They return a structure — the +first element of which is the signed summation, and the second element of which +is a bit specifying if the signed summation resulted in an overflow.
+ ++ %res = call {i32, i1} @llvm.sadd.with.overflow.i32(i32 %a, i32 %b) + %sum = extractvalue {i32, i1} %res, 0 + %obit = extractvalue {i32, i1} %res, 1 + br i1 %obit, label %overflow, label %normal ++ +
This is an overloaded intrinsic. You can use llvm.uadd.with.overflow +on any integer bit width. However, not all targets support all bit widths.
+ ++ declare {i16, i1} @llvm.uadd.with.overflow.i16(i16 %a, i16 %b) + declare {i32, i1} @llvm.uadd.with.overflow.i32(i32 %a, i32 %b) + declare {i64, i1} @llvm.uadd.with.overflow.i64(i64 %a, i64 %b) ++ +
The 'llvm.uadd.with.overflow' family of intrinsic functions perform +an unsigned addition of the two arguments, and indicate whether a carry occurred +during the unsigned summation.
+ +The arguments (%a and %b) and the first element of the result structure may +be of integer types of any bit width, but they must have the same bit width. The +second element of the result structure must be of type i1. %a +and %b are the two values that will undergo unsigned addition.
+ +The 'llvm.uadd.with.overflow' family of intrinsic functions perform +an unsigned addition of the two arguments. They return a structure — the +first element of which is the sum, and the second element of which is a bit +specifying if the unsigned summation resulted in a carry.
+ ++ %res = call {i32, i1} @llvm.uadd.with.overflow.i32(i32 %a, i32 %b) + %sum = extractvalue {i32, i1} %res, 0 + %obit = extractvalue {i32, i1} %res, 1 + br i1 %obit, label %carry, label %normal ++ +
This is an overloaded intrinsic. You can use llvm.ssub.with.overflow +on any integer bit width. However, not all targets support all bit widths.
+ ++ declare {i16, i1} @llvm.ssub.with.overflow.i16(i16 %a, i16 %b) + declare {i32, i1} @llvm.ssub.with.overflow.i32(i32 %a, i32 %b) + declare {i64, i1} @llvm.ssub.with.overflow.i64(i64 %a, i64 %b) ++ +
The 'llvm.ssub.with.overflow' family of intrinsic functions perform +a signed subtraction of the two arguments, and indicate whether an overflow +occurred during the signed subtraction.
+ +The arguments (%a and %b) and the first element of the result structure may +be of integer types of any bit width, but they must have the same bit width. The +second element of the result structure must be of type i1. %a +and %b are the two values that will undergo signed subtraction.
+ +The 'llvm.ssub.with.overflow' family of intrinsic functions perform +a signed subtraction of the two arguments. They return a structure — the +first element of which is the subtraction, and the second element of which is a bit +specifying if the signed subtraction resulted in an overflow.
+ ++ %res = call {i32, i1} @llvm.ssub.with.overflow.i32(i32 %a, i32 %b) + %sum = extractvalue {i32, i1} %res, 0 + %obit = extractvalue {i32, i1} %res, 1 + br i1 %obit, label %overflow, label %normal ++ +
This is an overloaded intrinsic. You can use llvm.usub.with.overflow +on any integer bit width. However, not all targets support all bit widths.
+ ++ declare {i16, i1} @llvm.usub.with.overflow.i16(i16 %a, i16 %b) + declare {i32, i1} @llvm.usub.with.overflow.i32(i32 %a, i32 %b) + declare {i64, i1} @llvm.usub.with.overflow.i64(i64 %a, i64 %b) ++ +
The 'llvm.usub.with.overflow' family of intrinsic functions perform +an unsigned subtraction of the two arguments, and indicate whether an overflow +occurred during the unsigned subtraction.
+ +The arguments (%a and %b) and the first element of the result structure may +be of integer types of any bit width, but they must have the same bit width. The +second element of the result structure must be of type i1. %a +and %b are the two values that will undergo unsigned subtraction.
+ +The 'llvm.usub.with.overflow' family of intrinsic functions perform +an unsigned subtraction of the two arguments. They return a structure — the +first element of which is the subtraction, and the second element of which is a bit +specifying if the unsigned subtraction resulted in an overflow.
+ ++ %res = call {i32, i1} @llvm.usub.with.overflow.i32(i32 %a, i32 %b) + %sum = extractvalue {i32, i1} %res, 0 + %obit = extractvalue {i32, i1} %res, 1 + br i1 %obit, label %overflow, label %normal ++ +
This is an overloaded intrinsic. You can use llvm.smul.with.overflow +on any integer bit width. However, not all targets support all bit widths.
+ ++ declare {i16, i1} @llvm.smul.with.overflow.i16(i16 %a, i16 %b) + declare {i32, i1} @llvm.smul.with.overflow.i32(i32 %a, i32 %b) + declare {i64, i1} @llvm.smul.with.overflow.i64(i64 %a, i64 %b) ++ +
The 'llvm.smul.with.overflow' family of intrinsic functions perform +a signed multiplication of the two arguments, and indicate whether an overflow +occurred during the signed multiplication.
+ +The arguments (%a and %b) and the first element of the result structure may +be of integer types of any bit width, but they must have the same bit width. The +second element of the result structure must be of type i1. %a +and %b are the two values that will undergo signed multiplication.
+ +The 'llvm.smul.with.overflow' family of intrinsic functions perform +a signed multiplication of the two arguments. They return a structure — +the first element of which is the multiplication, and the second element of +which is a bit specifying if the signed multiplication resulted in an +overflow.
+ ++ %res = call {i32, i1} @llvm.smul.with.overflow.i32(i32 %a, i32 %b) + %sum = extractvalue {i32, i1} %res, 0 + %obit = extractvalue {i32, i1} %res, 1 + br i1 %obit, label %overflow, label %normal ++