blob: 3dcfbf2d99661bf31bc151bff7eb57369e8faa64 [file] [log] [blame]
Eli Friedman73e8a7842018-08-16 18:39:39 +00001; RUN: llc < %s -mtriple=wasm32 | FileCheck %s --check-prefixes=WASM32
2; NOTE: did not compile on wasm64 at the time the test was created!
3
4define { i128, i8 } @muloti_test(i128 %l, i128 %r) unnamed_addr #0 {
5; WASM32-LABEL: muloti_test
6; WASM32: get_global $push18=, __stack_pointer@GLOBAL
7; WASM32: i32.const $push19=, 48
8; WASM32: i32.sub $push40=, $pop18, $pop19
9; WASM32: tee_local $push39=, 5, $pop40
10; WASM32: set_global __stack_pointer@GLOBAL, $pop39
11; WASM32: get_local $push41=, 5
12; WASM32: i32.const $push22=, 32
13; WASM32: i32.add $push23=, $pop41, $pop22
14; WASM32: get_local $push43=, 1
15; WASM32: i64.const $push0=, 0
16; WASM32: get_local $push42=, 3
17; WASM32: i64.const $push38=, 0
18; WASM32: call __multi3@FUNCTION, $pop23, $pop43, $pop0, $pop42, $pop38
19; WASM32: get_local $push44=, 5
20; WASM32: i32.const $push24=, 16
21; WASM32: i32.add $push25=, $pop44, $pop24
22; WASM32: get_local $push46=, 4
23; WASM32: i64.const $push37=, 0
24; WASM32: get_local $push45=, 1
25; WASM32: i64.const $push36=, 0
26; WASM32: call __multi3@FUNCTION, $pop25, $pop46, $pop37, $pop45, $pop36
27; WASM32: get_local $push49=, 5
28; WASM32: get_local $push48=, 2
29; WASM32: i64.const $push35=, 0
30; WASM32: get_local $push47=, 3
31; WASM32: i64.const $push34=, 0
32; WASM32: call __multi3@FUNCTION, $pop49, $pop48, $pop35, $pop47, $pop34
33; WASM32: get_local $push51=, 0
34; WASM32: get_local $push50=, 5
35; WASM32: i64.load $push1=, 32($pop50)
36; WASM32: i64.store 0($pop51), $pop1
37; WASM32: get_local $push55=, 0
38; WASM32: get_local $push52=, 5
39; WASM32: i32.const $push5=, 40
40; WASM32: i32.add $push6=, $pop52, $pop5
41; WASM32: i64.load $push33=, 0($pop6)
42; WASM32: tee_local $push32=, 1, $pop33
43; WASM32: get_local $push53=, 5
44; WASM32: i64.load $push3=, 0($pop53)
45; WASM32: get_local $push54=, 5
46; WASM32: i64.load $push2=, 16($pop54)
47; WASM32: i64.add $push4=, $pop3, $pop2
48; WASM32: i64.add $push31=, $pop32, $pop4
49; WASM32: tee_local $push30=, 3, $pop31
50; WASM32: i64.store 8($pop55), $pop30
51; WASM32: get_local $push62=, 0
52; WASM32: get_local $push56=, 2
53; WASM32: i64.const $push29=, 0
54; WASM32: i64.ne $push8=, $pop56, $pop29
55; WASM32: get_local $push57=, 4
56; WASM32: i64.const $push28=, 0
57; WASM32: i64.ne $push7=, $pop57, $pop28
58; WASM32: i32.and $push9=, $pop8, $pop7
59; WASM32: get_local $push58=, 5
60; WASM32: i64.load $push10=, 8($pop58)
61; WASM32: i64.const $push27=, 0
62; WASM32: i64.ne $push11=, $pop10, $pop27
63; WASM32: i32.or $push12=, $pop9, $pop11
64; WASM32: get_local $push59=, 5
65; WASM32: i64.load $push13=, 24($pop59)
66; WASM32: i64.const $push26=, 0
67; WASM32: i64.ne $push14=, $pop13, $pop26
68; WASM32: i32.or $push15=, $pop12, $pop14
69; WASM32: get_local $push61=, 3
70; WASM32: get_local $push60=, 1
71; WASM32: i64.lt_u $push16=, $pop61, $pop60
72; WASM32: i32.or $push17=, $pop15, $pop16
73; WASM32: i32.store8 16($pop62), $pop17
74; WASM32: get_local $push63=, 5
75; WASM32: i32.const $push20=, 48
76; WASM32: i32.add $push21=, $pop63, $pop20
77; WASM32: set_global __stack_pointer@GLOBAL, $pop21
78
79start:
80 %0 = tail call { i128, i1 } @llvm.umul.with.overflow.i128(i128 %l, i128 %r) #2
81 %1 = extractvalue { i128, i1 } %0, 0
82 %2 = extractvalue { i128, i1 } %0, 1
83 %3 = zext i1 %2 to i8
84 %4 = insertvalue { i128, i8 } undef, i128 %1, 0
85 %5 = insertvalue { i128, i8 } %4, i8 %3, 1
86 ret { i128, i8 } %5
87}
88
89; Function Attrs: nounwind readnone speculatable
90declare { i128, i1 } @llvm.umul.with.overflow.i128(i128, i128) #1
91
92attributes #0 = { nounwind readnone uwtable }
93attributes #1 = { nounwind readnone speculatable }
94attributes #2 = { nounwind }