Sumanth Gundapaneni | d5aa0f3 | 2017-07-18 15:31:37 +0000 | [diff] [blame] | 1 | ;RUN: llc -O2 -hexagon-emit-lut-text=true < %s | FileCheck --check-prefix=TEXT %s |
| 2 | ;If the look up table is used by more than one function, we should ignore the |
| 3 | ;flag and place it the rodata. |
| 4 | target datalayout = "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048" |
| 5 | target triple = "hexagon-unknown--elf" |
| 6 | |
| 7 | ;TEXT: .text |
| 8 | ;TEXT: .section{{.*}}.rodata |
| 9 | ;TEXT: .Lswitch.table: |
| 10 | ;TEXT-NEXT: .word |
| 11 | @switch.table = private unnamed_addr constant [9 x i32] [i32 9, i32 20, i32 14, i32 22, i32 12, i32 5, i32 98, i32 8, i32 11] |
| 12 | |
| 13 | ; Function Attrs: norecurse nounwind readnone |
| 14 | define i32 @foo(i32 %x) local_unnamed_addr #0 { |
| 15 | entry: |
| 16 | %0 = icmp ult i32 %x, 9 |
| 17 | br i1 %0, label %switch.lookup, label %return |
| 18 | |
| 19 | switch.lookup: ; preds = %entry |
| 20 | %switch.gep = getelementptr inbounds [9 x i32], [9 x i32]* @switch.table, i32 0, i32 %x |
| 21 | %switch.load = load i32, i32* %switch.gep, align 4 |
| 22 | ret i32 %switch.load |
| 23 | |
| 24 | return: ; preds = %entry |
| 25 | ret i32 19 |
| 26 | } |
| 27 | |
| 28 | define i32 @goo(i32 %x) local_unnamed_addr #0 { |
| 29 | entry: |
| 30 | %0 = icmp ult i32 %x, 9 |
| 31 | br i1 %0, label %switch.lookup, label %return |
| 32 | |
| 33 | switch.lookup: ; preds = %entry |
| 34 | %switch.gep = getelementptr inbounds [9 x i32], [9 x i32]* @switch.table, i32 0, i32 %x |
| 35 | %switch.load = load i32, i32* %switch.gep, align 4 |
| 36 | ret i32 %switch.load |
| 37 | |
| 38 | return: ; preds = %entry |
| 39 | ret i32 19 |
| 40 | } |
| 41 | |
Sumanth Gundapaneni | e1983bc | 2017-10-18 18:07:07 +0000 | [diff] [blame] | 42 | attributes #0 = { norecurse nounwind readnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="hexagonv60" "target-features"="-hvx,-long-calls" "unsafe-fp-math"="false" "use-soft-float"="false" } |