Just try it for yourself. Inst that the whole point of the homework assignment?
unsigned char fun1 ( unsigned char a, unsigned char b)
{
return (a+b);
}
unsigned int fun2 ( unsigned int a, unsigned int b)
{
return (a+b);
}
unsigned long fun3 ( unsigned long a, unsigned long b)
{
return (a+b);
}
Dont have/want your compiler, but it should be obvious before you start this exercise what is going to happen. If you mismatch the high level language variable/operand size to the architecture either the architecture has a solution directly or the architecture has to mask or cascade.
I have shown an array of different architectures here:
00000000 <fun1>:
0: e0800001 add r0, r0, r1
4: e20000ff and r0, r0, #255 ; 0xff
8: e12fff1e bx lr
0000000c <fun2>:
c: e0800001 add r0, r0, r1
10: e12fff1e bx lr
00000000 <_fun1>:
0: 1166 mov r5, -(sp)
2: 1185 mov sp, r5
4: 9d40 0004 movb 4(r5), r0
8: 9d41 0006 movb 6(r5), r1
c: 6040 add r1, r0
e: 1585 mov (sp)+, r5
10: 0087 rts pc
00000012 <_fun2>:
12: 1166 mov r5, -(sp)
14: 1185 mov sp, r5
16: 1d40 0004 mov 4(r5), r0
1a: 6d40 0006 add 6(r5), r0
1e: 1585 mov (sp)+, r5
20: 0087 rts pc
00000022 <_fun3>:
22: 1166 mov r5, -(sp)
24: 1185 mov sp, r5
26: 1d40 0004 mov 4(r5), r0
2a: 1d41 0006 mov 6(r5), r1
2e: 6d40 0008 add 10(r5), r0
32: 6d41 000a add 12(r5), r1
36: 0b40 adc r0
38: 1585 mov (sp)+, r5
3a: 0087 rts pc
00000000 <fun1>:
0: 86 0f add r24, r22
2: 08 95 ret
00000004 <fun2>:
4: 86 0f add r24, r22
6: 97 1f adc r25, r23
8: 08 95 ret
0000000a <fun3>:
a: 62 0f add r22, r18
c: 73 1f adc r23, r19
e: 84 1f adc r24, r20
10: 95 1f adc r25, r21
12: 08 95 ret
00000000 <fun1>:
0: 4f 5e add.b r14, r15
2: 30 41 ret
00000004 <fun2>:
4: 0f 5e add r14, r15
6: 30 41 ret
00000008 <fun3>:
8: 0e 5c add r12, r14
a: 0f 6d addc r13, r15
c: 30 41 ret
0000000000000000 <fun1>:
0: 12001c21 and w1, w1, #0xff
4: 0b200020 add w0, w1, w0, uxtb
8: d65f03c0 ret
c: d503201f nop
0000000000000010 <fun2>:
10: 0b010000 add w0, w0, w1
14: d65f03c0 ret
00000000 <fun1>:
0: 00851021 addu $2,$4,$5
4: 03e00008 jr $31
8: 304200ff andi $2,$2,0xff
0000000c <fun2>:
c: 03e00008 jr $31
10: 00851021 addu $2,$4,$5
See what the compilers in the homework assignment produce for your specific code as I modified it a little bit (and fixed the bugs), my inputs and outputs match, having them mismatch just adds more fun to this assignment.
EDIT
yes 8 bits plus 8 bits is 9 bits and that fits just fine in 16 or 18 or 24,32, 36, 64, etc. although a number of those dont have a lot of registers and work through memory where you get different advantages.
00000000 <ufun>:
0: e0800001 add r0, r0, r1
4: e12fff1e bx lr
00000008 <sfun>:
8: e0800001 add r0, r0, r1
c: e12fff1e bx lr
0000000000000000 <ufun>:
0: 12001c21 and w1, w1, #0xff
4: 0b200020 add w0, w1, w0, uxtb
8: d65f03c0 ret
c: d503201f nop
0000000000000010 <sfun>:
10: 13001c21 sxtb w1, w1
14: 0b208020 add w0, w1, w0, sxtb
18: d65f03c0 ret
1c: d503201f nop
00000000 <ufun>:
0: 03e00008 jr $31
4: 00851021 addu $2,$4,$5
00000008 <sfun>:
8: 03e00008 jr $31
c: 00851021 addu $2,$4,$5
00000000 <ufun>:
0: 4f 4f mov.b r15, r15
2: 4e 4e mov.b r14, r14
4: 0f 5e add r14, r15
6: 30 41 ret
00000008 <sfun>:
8: 8f 11 sxt r15
a: 8e 11 sxt r14
c: 0f 5e add r14, r15
e: 30 41 ret
00000000 <ufun>:
0: 70 e0 ldi r23, 0x00 ; 0
2: 26 2f mov r18, r22
4: 37 2f mov r19, r23
6: 28 0f add r18, r24
8: 31 1d adc r19, r1
a: 82 2f mov r24, r18
c: 93 2f mov r25, r19
e: 08 95 ret
00000010 <sfun>:
10: 06 2e mov r0, r22
12: 00 0c add r0, r0
14: 77 0b sbc r23, r23
16: 26 2f mov r18, r22
18: 37 2f mov r19, r23
1a: 28 0f add r18, r24
1c: 31 1d adc r19, r1
1e: 87 fd sbrc r24, 7
20: 3a 95 dec r19
22: 82 2f mov r24, r18
24: 93 2f mov r25, r19
26: 08 95 ret
00000000 <_ufun>:
0: 1166 mov r5, -(sp)
2: 1185 mov sp, r5
4: 9d41 0004 movb 4(r5), r1
8: 45c1 ff00 bic $-400, r1
c: 9d40 0006 movb 6(r5), r0
10: 45c0 ff00 bic $-400, r0
14: 6040 add r1, r0
16: 1585 mov (sp)+, r5
18: 0087 rts pc
0000001a <_sfun>:
1a: 1166 mov r5, -(sp)
1c: 1185 mov sp, r5
1e: 9d41 0004 movb 4(r5), r1
22: 9d40 0006 movb 6(r5), r0
26: 6040 add r1, r0
28: 1585 mov (sp)+, r5
2a: 0087 rts pc
00000000 <ufun>:
0: 952e add x10,x10,x11
2: 8082 ret
00000004 <sfun>:
4: 952e add x10,x10,x11
6: 8082 ret