brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · a8da89b Raw
58 lines · plain
1// RUN: mlir-opt %s -split-input-file -verify-diagnostics| FileCheck %s2 3// CHECK-LABEL: @test_enum_attr_roundtrip4func.func @test_enum_attr_roundtrip() -> () {5  // CHECK: attr = #test.custom_float<"float" : 2.000000e+00>6  "test.op"() {attr = #test.custom_float<"float" : 2.>} : () -> ()7  // CHECK: attr = #test.custom_float<"double" : 2.000000e+00>8  "test.op"() {attr = #test.custom_float<"double" : 2.>} : () -> ()9   // CHECK: attr = #test.custom_float<"fp80" : 2.000000e+00>10  "test.op"() {attr = #test.custom_float<"fp80" : 2.>} : () -> ()11  // CHECK: attr = #test.custom_float<"float" : 0x7FC00000>12  "test.op"() {attr = #test.custom_float<"float" : 0x7FC00000>} : () -> ()13  // CHECK: attr = #test.custom_float<"double" : 0x7FF0000001000000>14  "test.op"() {attr = #test.custom_float<"double" : 0x7FF0000001000000>} : () -> ()15  // CHECK: attr = #test.custom_float<"fp80" : 0x7FFFC000000000100000>16  "test.op"() {attr = #test.custom_float<"fp80" : 0x7FFFC000000000100000>} : () -> ()17  return18}19 20// -----21 22// Verify literal must be hex or float23 24// expected-error @below {{unexpected decimal integer literal for a floating point value}}25// expected-note @below {{add a trailing dot to make the literal a float}}26"test.op"() {attr = #test.custom_float<"float" : 42>} : () -> ()27 28// -----29 30// Integer value must be in the width of the floating point type31 32// expected-error @below {{hexadecimal float constant out of range for type}}33"test.op"() {attr = #test.custom_float<"float" : 0x7FC000000>} : () -> ()34 35 36// -----37 38// Integer value must be in the width of the floating point type39 40// expected-error @below {{hexadecimal float constant out of range for type}}41"test.op"() {attr = #test.custom_float<"double" : 0x7FC000007FC0000000>} : () -> ()42 43 44// -----45 46// Integer value must be in the width of the floating point type47 48// expected-error @below {{hexadecimal float constant out of range for type}}49"test.op"() {attr = #test.custom_float<"fp80" : 0x7FC0000007FC0000007FC000000>} : () -> ()50 51// -----52 53// Value must be a floating point literal or integer literal54 55// expected-error @below {{expected floating point literal}}56"test.op"() {attr = #test.custom_float<"float" : "blabla">} : () -> ()57 58