Ignore:
Timestamp:
Sep 9, 2014, 1:51:04 PM (5 years ago)
Author:
linmengl
Message:

add test code for add_with_carry_ir, detect a bug on AVX2.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib_ir/gen/llc_func.pytemplate.ll

    r4138 r4143  
    100100}
    101101
     102define void @add_with_carry_ir(<2 x i64> %a, <2 x i64> %b, <2 x i64> %carry_in, <2 x i64>* %carry_out, <2 x i64>* %sum) {
     103entry:
     104  %aa = bitcast <2 x i64> %a to i128
     105  %bb = bitcast <2 x i64> %b to i128
     106  %cin = bitcast <2 x i64> %carry_in to i128
     107
     108  %res1 = call {i128, i1} @llvm.uadd.with.overflow.i128(i128 %aa, i128 %bb)
     109  %sum1 = extractvalue {i128, i1} %res1, 0
     110  %obit1 = extractvalue {i128, i1} %res1, 1
     111
     112  %res2 = call {i128, i1} @llvm.uadd.with.overflow.i128(i128 %sum1, i128 %cin)
     113  %sum2 = extractvalue {i128, i1} %res2, 0
     114  %obit2 = extractvalue {i128, i1} %res2, 1
     115
     116  %ret_sum = bitcast i128 %sum2 to <2 x i64>
     117  %obit = or i1 %obit1, %obit2
     118  %obit_64 = zext i1 %obit to i64
     119  %obit_2x64 = insertelement <2 x i64> zeroinitializer, i64 %obit_64, i32 0
     120
     121  store <2 x i64> %ret_sum, <2 x i64>* %sum
     122  store <2 x i64> %obit_2x64, <2 x i64>* %carry_out
     123
     124  ret void
     125}
     126
    102127define <4 x i32> @add_128(<4 x i32> %a, <4 x i32> %b) {
    103128entry:
     
    118143}
    119144
    120 define i32 @sign_mask_64(<2 x i64> %a) {
    121 entry:
    122   %aa = icmp slt <2 x i64> %a, zeroinitializer
    123   %a1 = bitcast <2 x i1> %aa to i2
    124   %a2 = zext i2 %a1 to i32
    125   ret i32 %a2
    126 }
Note: See TracChangeset for help on using the changeset viewer.