0000000000000000 <main>: 0: 55 push %rbp 1: 48 89 e5 mov %rsp,%rbp 4: 48 81 ec 10 00 00 00 sub $0x10,%rsp b: b8 01 00 00 00 mov $0x1,%eax 10: 48 89 c1 mov %rax,%rcx 13: 81 e1 ff ff 00 00 and $0xffff,%ecx 19: 8b 55 fc mov -0x4(%rbp),%edx 1c: 81 e2 00 00 ff ff and $0xffff0000,%edx 22: 09 d1 or %edx,%ecx 24: 89 4d fc mov %ecx,-0x4(%rbp) 27: b8 02 00 00 00 mov $0x2,%eax 2c: 48 89 c1 mov %rax,%rcx 2f: 81 e1 ff ff 00 00 and $0xffff,%ecx 35: c1 e1 10 shl $0x10,%ecx 38: 8b 55 fc mov -0x4(%rbp),%edx 3b: 81 e2 ff ff 00 00 and $0xffff,%edx 41: 09 d1 or %edx,%ecx 43: 89 4d fc mov %ecx,-0x4(%rbp) 46: b8 00 00 00 00 mov $0x0,%eax 4b: e9 00 00 00 00 jmpq 50 <main+0x50> 50: c9 leaveq 51: c3 retq After the patch Disassembly of section .text: 0000000000000000 <main>: 0: 55 push %rbp 1: 48 89 e5 mov %rsp,%rbp 4: 48 81 ec 10 00 00 00 sub $0x10,%rsp b: 8b 45 fc mov -0x4(%rbp),%eax e: 81 e0 00 00 ff ff and $0xffff0000,%eax 14: 83 c8 01 or $0x1,%eax 17: 89 45 fc mov %eax,-0x4(%rbp) 1a: 8b 45 fc mov -0x4(%rbp),%eax 1d: 81 e0 ff ff 00 00 and $0xffff,%eax 23: 81 c8 00 00 02 00 or $0x20000,%eax 29: 89 45 fc mov %eax,-0x4(%rbp) 2c: b8 00 00 00 00 mov $0x0,%eax 31: e9 00 00 00 00 jmpq 36 <main+0x36> 36: c9 leaveq 37: c3 retq
Unified · Split
| @@ -1019,6 +1019,7 @@ ST_FUNC void lexpand_nr(void) · 1018 unmodified lines | ||
| 1019 | 1019 | } |
| 1020 | 1020 | #endif |
| 1021 | 1021 | |
| 1022 | +#ifndef TCC_TARGET_X86_64 | |
| 1022 | 1023 | /* build a long long from two ints */ |
| 1023 | 1024 | static void lbuild(int t) |
| 1024 | 1025 | { |
| @@ -1027,6 +1028,7 @@ static void lbuild(int t) · 2 unmodified lines | ||
| 1027 | 1028 | vtop[-1].type.t = t; |
| 1028 | 1029 | vpop(); |
| 1029 | 1030 | } |
| 1031 | +#endif | |
| 1030 | 1032 | |
| 1031 | 1033 | /* rotate n first stack elements to the bottom |
| 1032 | 1034 | I1 ... In -> I2 ... In I1 [top is right] |
| @@ -1088,8 +1090,8 @@ static void gv_dup(void) · 55 unmodified lines | ||
| 1088 | 1090 | { |
| 1089 | 1091 | int rc, t, r, r1; |
| 1090 | 1092 | SValue sv; |
| 1091 | − | |
| 1092 | 1093 | t = vtop->type.t; |
| 1094 | +#ifndef TCC_TARGET_X86_64 | |
| 1093 | 1095 | if ((t & VT_BTYPE) == VT_LLONG) { |
| 1094 | 1096 | lexpand(); |
| 1095 | 1097 | gv_dup(); |
| @@ -1099,15 +1101,14 @@ static void gv_dup(void) · 3 unmodified lines | ||
| 1099 | 1101 | vrotb(4); |
| 1100 | 1102 | /* stack: H L L1 H1 */ |
| 1101 | 1103 | lbuild(t); |
| 1102 | − vrotb(3); | |
| 1103 | − vrotb(3); | |
| 1104 | + vrott(3); | |
| 1104 | 1105 | vswap(); |
| 1105 | 1106 | lbuild(t); |
| 1106 | 1107 | vswap(); |
| 1107 | − } else { | |
| 1108 | + } else | |
| 1109 | +#endif | |
| 1110 | + { | |
| 1108 | 1111 | /* duplicate value */ |
| 1109 | − rc = RC_INT; | |
| 1110 | − sv.type.t = VT_INT; | |
| 1111 | 1112 | if (is_float(t)) { |
| 1112 | 1113 | rc = RC_FLOAT; |
| 1113 | 1114 | #ifdef TCC_TARGET_X86_64 |
| @@ -1115,8 +1116,9 @@ static void gv_dup(void) · 1 unmodified line | ||
| 1115 | 1116 | rc = RC_ST0; |
| 1116 | 1117 | } |
| 1117 | 1118 | #endif |
| 1118 | − sv.type.t = t; | |
| 1119 | − } | |
| 1119 | + }else | |
| 1120 | + rc = RC_INT; | |
| 1121 | + sv.type.t = t; | |
| 1120 | 1122 | r = gv(rc); |
| 1121 | 1123 | r1 = get_reg(rc); |
| 1122 | 1124 | sv.r = r; |
| @@ -2549,11 +2551,6 @@ ST_FUNC void vstore(void) · 1426 unmodified lines | ||
| 2549 | 2551 | /* remove bit field info to avoid loops */ |
| 2550 | 2552 | vtop[-1].type.t = ft & ~(VT_BITFIELD | (-1 << VT_STRUCT_SHIFT)); |
| 2551 | 2553 | |
| 2552 | − /* duplicate source into other register */ | |
| 2553 | − gv_dup(); | |
| 2554 | − vswap(); | |
| 2555 | − vrott(3); | |
| 2556 | − | |
| 2557 | 2554 | if((ft & VT_BTYPE) == VT_BOOL) { |
| 2558 | 2555 | gen_cast(&vtop[-1].type); |
| 2559 | 2556 | vtop[-1].type.t = (vtop[-1].type.t & ~VT_BTYPE) | (VT_BYTE | VT_UNSIGNED); |
| @@ -2585,10 +2582,6 @@ ST_FUNC void vstore(void) · 25 unmodified lines | ||
| 2585 | 2582 | gen_op('|'); |
| 2586 | 2583 | /* store result */ |
| 2587 | 2584 | vstore(); |
| 2588 | − | |
| 2589 | − /* pop off shifted source from "duplicate source..." above */ | |
| 2590 | − vpop(); | |
| 2591 | − | |
| 2592 | 2585 | } else { |
| 2593 | 2586 | #ifdef CONFIG_TCC_BCHECK |
| 2594 | 2587 | /* bound check case */ |