| Index: tests_lit/llvm2ice_tests/randomize-pool-immediate-basic.ll
|
| diff --git a/tests_lit/llvm2ice_tests/randomize-pool-immediate-basic.ll b/tests_lit/llvm2ice_tests/randomize-pool-immediate-basic.ll
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..5ab70e61a1ecc81692294dcef485498dd4301703
|
| --- /dev/null
|
| +++ b/tests_lit/llvm2ice_tests/randomize-pool-immediate-basic.ll
|
| @@ -0,0 +1,70 @@
|
| +; This is a smoke test of constant blinding and constant pooling.
|
| +
|
| +; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \
|
| +; RUN: -sz-seed=1 -randomize-pool-immediates=constant-blinding \
|
| +; RUN: | FileCheck %s --check-prefix=BLINDINGO2
|
| +; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 \
|
| +; RUN: -sz-seed=1 -randomize-pool-immediates=constant-blinding \
|
| +; RUN: | FileCheck %s --check-prefix=BLINDINGOM1
|
| +
|
| +; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \
|
| +; RUN: -sz-seed=1 -randomize-pool-immediates=constant-pooling \
|
| +; RUN: | FileCheck %s --check-prefix=POOLING
|
| +; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 \
|
| +; RUN: -sz-seed=1 -randomize-pool-immediates=constant-pooling \
|
| +; RUN: | FileCheck %s --check-prefix=POOLING
|
| +
|
| +
|
| +define i32 @add_arg_plus_200000(i32 %arg) {
|
| +entry:
|
| + %res = add i32 200000, %arg
|
| + ret i32 %res
|
| +
|
| +; BLINDINGO2-LABEL: add_arg_plus_200000
|
| +; BLINDINGO2: mov [[REG:e[a-z]*]],0x34ee7
|
| +; BLINDINGO2-NEXT: lea [[REG]],{{[[]}}[[REG]]-0x41a7{{[]]}}
|
| +
|
| +; BLINDINGOM1-LABEL: add_arg_plus_200000
|
| +; BLINDINGOM1: mov [[REG:e[a-z]*]],0x34ee7
|
| +; BLINDINGOM1-NEXT: lea [[REG]],{{[[]}}[[REG]]-0x41a7{{[]]}}
|
| +
|
| +; POOLING-LABEL: add_arg_plus_200000
|
| +; POOLING: mov e{{[a-z]*}},DWORD PTR ds:0x0 {{[0-9]*[a-f]*}}: R_386_32 .L$i32${{[0-9]*}}
|
| +}
|
| +
|
| +define float @load_arg_plus_200000(float* %arg) {
|
| +entry:
|
| + %arg.int = ptrtoint float* %arg to i32
|
| + %addr.int = add i32 %arg.int, 200000
|
| + %addr.ptr = inttoptr i32 %addr.int to float*
|
| + %addr.load = load float, float* %addr.ptr, align 4
|
| + ret float %addr.load
|
| +; BLINDINGO2-LABEL: load_arg_plus_200000
|
| +; BLINDINGO2: lea [[REG:e[a-z]*]],{{[[]}}{{e[a-z]*}}+0x34ee7{{[]]}}
|
| +
|
| +; BLINDINGOM1-LABEL: load_arg_plus_200000
|
| +; BLINDINGOM1: lea [[REG:e[a-z]*]],{{[[]}}{{e[a-z]*}}-0x41a7{{[]]}}
|
| +
|
| +; POOLING-LABEL: load_arg_plus_200000
|
| +; POOLING: mov e{{[a-z]*}},DWORD PTR ds:0x0 {{[0-9]*[a-f]*}}: R_386_32 .L$i32${{[0-9]*}}
|
| +}
|
| +
|
| +define i64 @add_arg_plus_64bits(i32 %arg) {
|
| +entry:
|
| + %0 = sext i32 %arg to i64
|
| + %res = add i64 90000000000, %0
|
| + ret i64 %res
|
| +
|
| +; BLINDINGO2-LABEL: add_arg_plus_64bits
|
| +; BLINDINGO2: sar [[RHI:e[a-z]*]],0x1f
|
| +; BLINDINGO2: mov [[RLO:e[a-z]*]],0xf46b45a7
|
| +; BLINDINGO2-NEXT: lea [[RLO]],{{[[]}}[[RLO]]-0x41a7{{[]]}}
|
| +
|
| +; BLINDINGOM1-LABEL: add_arg_plus_64bits
|
| +; BLINDINGOM1: sar [[RHI:e[a-z]*]],0x1f
|
| +; BLINDINGOM1: mov [[RLO:e[a-z]*]],0xf46b45a7
|
| +; BLINDINGOM1-NEXT: lea [[RLO]],{{[[]}}[[RLO]]-0x41a7{{[]]}}
|
| +
|
| +; POOLING-LABEL: add_arg_plus_64bits
|
| +; POOLING: mov e{{[a-z]*}},DWORD PTR ds:0x0 {{[0-9]*[a-f]*}}: R_386_32 .L$i32${{[0-9]*}}
|
| +}
|
|
|