81 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 52; RUN: opt < %s -passes=instcombine -S | FileCheck %s3 4@empty = private unnamed_addr constant [1 x i8] zeroinitializer, align 15@dec = private unnamed_addr constant [2 x i8] c"1\00", align 16@hex = private unnamed_addr constant [4 x i8] c"0xf\00", align 17 8define double @nan_empty() {9; CHECK-LABEL: define double @nan_empty() {10; CHECK-NEXT: ret double 0x7FF800000000000011;12 %res = call double @nan(ptr @empty)13 ret double %res14}15 16define double @nan_dec() {17; CHECK-LABEL: define double @nan_dec() {18; CHECK-NEXT: ret double 0x7FF800000000000119;20 %res = call double @nan(ptr @dec)21 ret double %res22}23 24define double @nan_hex() {25; CHECK-LABEL: define double @nan_hex() {26; CHECK-NEXT: ret double 0x7FF800000000000F27;28 %res = call double @nan(ptr @hex)29 ret double %res30}31 32define float @nanf_empty() {33; CHECK-LABEL: define float @nanf_empty() {34; CHECK-NEXT: ret float 0x7FF800000000000035;36 %res = call float @nanf(ptr @empty)37 ret float %res38}39 40; nagative tests41 42define double @nan_poison() {43; CHECK-LABEL: define double @nan_poison() {44; CHECK-NEXT: [[RES:%.*]] = call double @nan(ptr poison)45; CHECK-NEXT: ret double [[RES]]46;47 %res = call double @nan(ptr poison)48 ret double %res49}50 51define double @nan_undef() {52; CHECK-LABEL: define double @nan_undef() {53; CHECK-NEXT: [[RES:%.*]] = call double @nan(ptr undef)54; CHECK-NEXT: ret double [[RES]]55;56 %res = call double @nan(ptr undef)57 ret double %res58}59 60define double @nan_null() {61; CHECK-LABEL: define double @nan_null() {62; CHECK-NEXT: [[RES:%.*]] = call double @nan(ptr null)63; CHECK-NEXT: ret double [[RES]]64;65 %res = call double @nan(ptr null)66 ret double %res67}68 69define double @nan_non_constant(ptr %x) {70; CHECK-LABEL: define double @nan_non_constant(71; CHECK-SAME: ptr [[X:%.*]]) {72; CHECK-NEXT: [[RES:%.*]] = call double @nan(ptr [[X]])73; CHECK-NEXT: ret double [[RES]]74;75 %res = call double @nan(ptr %x)76 ret double %res77}78 79declare float @nanf(ptr)80declare double @nan(ptr)81