Hex Artifact Content
Not logged in

Artifact 58b5ceec25df564f26a0f5600eff152022f17bee:


0000: 2f 2a 20 3d 3d 3d 2d 2d 20 61 64 64 76 73 69 33  /* ===-- addvsi3
0010: 2e 63 20 2d 20 49 6d 70 6c 65 6d 65 6e 74 20 5f  .c - Implement _
0020: 5f 61 64 64 76 73 69 33 20 2d 2d 2d 2d 2d 2d 2d  _addvsi3 -------
0030: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0040: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 3d 3d 3d 0a  ------------===.
0050: 20 2a 0a 20 2a 20 20 20 20 20 20 20 20 20 20 20   *. *           
0060: 20 20 20 20 20 20 20 20 20 54 68 65 20 4c 4c 56           The LLV
0070: 4d 20 43 6f 6d 70 69 6c 65 72 20 49 6e 66 72 61  M Compiler Infra
0080: 73 74 72 75 63 74 75 72 65 0a 20 2a 0a 20 2a 20  structure. *. * 
0090: 54 68 69 73 20 66 69 6c 65 20 69 73 20 64 75 61  This file is dua
00a0: 6c 20 6c 69 63 65 6e 73 65 64 20 75 6e 64 65 72  l licensed under
00b0: 20 74 68 65 20 4d 49 54 20 61 6e 64 20 74 68 65   the MIT and the
00c0: 20 55 6e 69 76 65 72 73 69 74 79 20 6f 66 20 49   University of I
00d0: 6c 6c 69 6e 6f 69 73 20 4f 70 65 6e 0a 20 2a 20  llinois Open. * 
00e0: 53 6f 75 72 63 65 20 4c 69 63 65 6e 73 65 73 2e  Source Licenses.
00f0: 20 53 65 65 20 4c 49 43 45 4e 53 45 2e 54 58 54   See LICENSE.TXT
0100: 20 66 6f 72 20 64 65 74 61 69 6c 73 2e 0a 20 2a   for details.. *
0110: 0a 20 2a 20 3d 3d 3d 2d 2d 2d 2d 2d 2d 2d 2d 2d  . * ===---------
0120: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0130: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0140: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0150: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 3d 3d 3d  -------------===
0160: 0a 20 2a 0a 20 2a 20 54 68 69 73 20 66 69 6c 65  . *. * This file
0170: 20 69 6d 70 6c 65 6d 65 6e 74 73 20 5f 5f 61 64   implements __ad
0180: 64 76 73 69 33 20 66 6f 72 20 74 68 65 20 63 6f  dvsi3 for the co
0190: 6d 70 69 6c 65 72 5f 72 74 20 6c 69 62 72 61 72  mpiler_rt librar
01a0: 79 2e 0a 20 2a 0a 20 2a 20 3d 3d 3d 2d 2d 2d 2d  y.. *. * ===----
01b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
01c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
01d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
01e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
01f0: 2d 2d 3d 3d 3d 0a 20 2a 2f 0a 0a 23 69 6e 63 6c  --===. */..#incl
0200: 75 64 65 20 22 69 6e 74 5f 6c 69 62 2e 68 22 0a  ude "int_lib.h".
0210: 0a 2f 2a 20 52 65 74 75 72 6e 73 3a 20 61 20 2b  ./* Returns: a +
0220: 20 62 20 2a 2f 0a 0a 2f 2a 20 45 66 66 65 63 74   b */../* Effect
0230: 73 3a 20 61 62 6f 72 74 73 20 69 66 20 61 20 2b  s: aborts if a +
0240: 20 62 20 6f 76 65 72 66 6c 6f 77 73 20 2a 2f 0a   b overflows */.
0250: 0a 43 4f 4d 50 49 4c 45 52 5f 52 54 5f 41 42 49  .COMPILER_RT_ABI
0260: 20 73 69 5f 69 6e 74 0a 5f 5f 61 64 64 76 73 69   si_int.__addvsi
0270: 33 28 73 69 5f 69 6e 74 20 61 2c 20 73 69 5f 69  3(si_int a, si_i
0280: 6e 74 20 62 29 0a 7b 0a 20 20 20 20 73 69 5f 69  nt b).{.    si_i
0290: 6e 74 20 73 20 3d 20 28 73 75 5f 69 6e 74 29 20  nt s = (su_int) 
02a0: 61 20 2b 20 28 73 75 5f 69 6e 74 29 20 62 3b 0a  a + (su_int) b;.
02b0: 20 20 20 20 69 66 20 28 62 20 3e 3d 20 30 29 0a      if (b >= 0).
02c0: 20 20 20 20 7b 0a 20 20 20 20 20 20 20 20 69 66      {.        if
02d0: 20 28 73 20 3c 20 61 29 0a 20 20 20 20 20 20 20   (s < a).       
02e0: 20 20 20 20 20 63 6f 6d 70 69 6c 65 72 72 74 5f       compilerrt_
02f0: 61 62 6f 72 74 28 29 3b 0a 20 20 20 20 7d 0a 20  abort();.    }. 
0300: 20 20 20 65 6c 73 65 0a 20 20 20 20 7b 0a 20 20     else.    {.  
0310: 20 20 20 20 20 20 69 66 20 28 73 20 3e 3d 20 61        if (s >= a
0320: 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 63 6f  ).            co
0330: 6d 70 69 6c 65 72 72 74 5f 61 62 6f 72 74 28 29  mpilerrt_abort()
0340: 3b 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 74 75  ;.    }.    retu
0350: 72 6e 20 73 3b 0a 7d 0a                          rn s;.}.