| Hans Wennborg | 75734f8 | 2016-02-18 18:44:33 +0000 | [diff] [blame] | 1 | ; RUN: llc -mtriple=i686-unknown-linux-gnu -march=x86-64 -mcpu=x86-64 < %s | FileCheck %s |
| Mehdi Amini | 3e0023b | 2015-02-16 21:47:58 +0000 | [diff] [blame] | 2 | |
| 3 | ; Make sure the float conversion is folded away as it should be. |
| 4 | ; CHECK-LABEL: foo |
| 5 | ; CHECK-NOT: cvt |
| 6 | ; CHECK: movzbl |
| 7 | define i32 @foo(i8 %a) #0 { |
| 8 | %conv = uitofp i8 %a to float |
| 9 | %conv1 = fptosi float %conv to i32 |
| 10 | ret i32 %conv1 |
| 11 | } |
| 12 | |
| 13 | ; CHECK-LABEL: foo2 |
| 14 | ; CHECK-NOT: cvt |
| 15 | ; CHECK: movsbl |
| 16 | define i32 @foo2(i8 %a) #0 { |
| 17 | %conv = sitofp i8 %a to float |
| 18 | %conv1 = fptosi float %conv to i32 |
| 19 | ret i32 %conv1 |
| 20 | } |
| 21 | |
| 22 | ; CHECK-LABEL: bar |
| 23 | ; CHECK-NOT: cvt |
| Ahmed Bougacha | 04a8fc2 | 2016-05-07 01:11:17 +0000 | [diff] [blame] | 24 | ; CHECK: movl |
| Mehdi Amini | 3e0023b | 2015-02-16 21:47:58 +0000 | [diff] [blame] | 25 | define zeroext i8 @bar(i8 zeroext %a) #0 { |
| 26 | %conv = uitofp i8 %a to float |
| 27 | %conv1 = fptoui float %conv to i8 |
| 28 | ret i8 %conv1 |
| 29 | } |
| 30 | |
| 31 | attributes #0 = { nounwind ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 32 | |