|
| 1 | +; ModuleID = 'float.go' |
| 2 | +source_filename = "float.go" |
| 3 | +target datalayout = "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128" |
| 4 | +target triple = "i686--linux" |
| 5 | + |
| 6 | +define internal void @main.init(i8* %context, i8* %parentHandle) unnamed_addr { |
| 7 | +entry: |
| 8 | + ret void |
| 9 | +} |
| 10 | + |
| 11 | +define internal i32 @main.f32tou32(float %v, i8* %context, i8* %parentHandle) unnamed_addr { |
| 12 | +entry: |
| 13 | + %positive = fcmp oge float %v, 0.000000e+00 |
| 14 | + %withinmax = fcmp ole float %v, 0x41EFFFFFC0000000 |
| 15 | + %inbounds = and i1 %positive, %withinmax |
| 16 | + %saturated = sext i1 %positive to i32 |
| 17 | + %normal = fptoui float %v to i32 |
| 18 | + %0 = select i1 %inbounds, i32 %normal, i32 %saturated |
| 19 | + ret i32 %0 |
| 20 | +} |
| 21 | + |
| 22 | +define internal float @main.maxu32f(i8* %context, i8* %parentHandle) unnamed_addr { |
| 23 | +entry: |
| 24 | + ret float 0x41F0000000000000 |
| 25 | +} |
| 26 | + |
| 27 | +define internal i32 @main.maxu32tof32(i8* %context, i8* %parentHandle) unnamed_addr { |
| 28 | +entry: |
| 29 | + ret i32 -1 |
| 30 | +} |
| 31 | + |
| 32 | +define internal { i32, i32, i32, i32 } @main.inftoi32(i8* %context, i8* %parentHandle) unnamed_addr { |
| 33 | +entry: |
| 34 | + ret { i32, i32, i32, i32 } { i32 -1, i32 0, i32 2147483647, i32 -2147483648 } |
| 35 | +} |
| 36 | + |
| 37 | +define internal i32 @main.u32tof32tou32(i32 %v, i8* %context, i8* %parentHandle) unnamed_addr { |
| 38 | +entry: |
| 39 | + %0 = uitofp i32 %v to float |
| 40 | + %withinmax = fcmp ole float %0, 0x41EFFFFFC0000000 |
| 41 | + %normal = fptoui float %0 to i32 |
| 42 | + %1 = select i1 %withinmax, i32 %normal, i32 -1 |
| 43 | + ret i32 %1 |
| 44 | +} |
| 45 | + |
| 46 | +define internal float @main.f32tou32tof32(float %v, i8* %context, i8* %parentHandle) unnamed_addr { |
| 47 | +entry: |
| 48 | + %positive = fcmp oge float %v, 0.000000e+00 |
| 49 | + %withinmax = fcmp ole float %v, 0x41EFFFFFC0000000 |
| 50 | + %inbounds = and i1 %positive, %withinmax |
| 51 | + %saturated = sext i1 %positive to i32 |
| 52 | + %normal = fptoui float %v to i32 |
| 53 | + %0 = select i1 %inbounds, i32 %normal, i32 %saturated |
| 54 | + %1 = uitofp i32 %0 to float |
| 55 | + ret float %1 |
| 56 | +} |
| 57 | + |
| 58 | +define internal i8 @main.f32tou8(float %v, i8* %context, i8* %parentHandle) unnamed_addr { |
| 59 | +entry: |
| 60 | + %positive = fcmp oge float %v, 0.000000e+00 |
| 61 | + %withinmax = fcmp ole float %v, 2.550000e+02 |
| 62 | + %inbounds = and i1 %positive, %withinmax |
| 63 | + %saturated = sext i1 %positive to i8 |
| 64 | + %normal = fptoui float %v to i8 |
| 65 | + %0 = select i1 %inbounds, i8 %normal, i8 %saturated |
| 66 | + ret i8 %0 |
| 67 | +} |
| 68 | + |
| 69 | +define internal i8 @main.f32toi8(float %v, i8* %context, i8* %parentHandle) unnamed_addr { |
| 70 | +entry: |
| 71 | + %abovemin = fcmp oge float %v, -1.280000e+02 |
| 72 | + %belowmax = fcmp ole float %v, 1.270000e+02 |
| 73 | + %inbounds = and i1 %abovemin, %belowmax |
| 74 | + %saturated = select i1 %abovemin, i8 127, i8 -128 |
| 75 | + %isnan = fcmp uno float %v, 0.000000e+00 |
| 76 | + %remapped = select i1 %isnan, i8 0, i8 %saturated |
| 77 | + %normal = fptosi float %v to i8 |
| 78 | + %0 = select i1 %inbounds, i8 %normal, i8 %remapped |
| 79 | + ret i8 %0 |
| 80 | +} |
0 commit comments