;; Verify that byte types are encoded as integer types in DXIL bitcode.
; RUN: llc --filetype=obj %s --stop-after=dxil-write-bitcode -o %t
; RUN: llvm-bcanalyzer --dump %t | FileCheck %s
target triple = "dxil--shadermodel6.5-library"
;; Since bitcode defines types up front and then refers back to them using
;; their indices, we unfortunately need to hardcode the entire type block here,
;; which means this test may be brittle.
;; See https://llvm.org/docs/BitCodeFormat.html for help interpreting below.
;
; CHECK:
; CHECK-NEXT:
; CHECK-NEXT:
;; 2: STRUCT_NAME + OPAQUE only take up one index here.
; CHECK-NEXT: record string = 'dxilOpaquePtrReservedName'
; CHECK-NEXT:
;; 3: i8
; CHECK-NEXT:
;; 4: [32 x i8]
; CHECK-NEXT:
;; 5-12: The return and operand types of @bytes, except `i8`,
; CHECK-NEXT:
; CHECK-NEXT:
; CHECK-NEXT:
; CHECK-NEXT:
; CHECK-NEXT:
; CHECK-NEXT:
; CHECK-NEXT:
; CHECK-NEXT:
;; 13: <8 x i5>
; CHECK-NEXT:
;; 14: <2 x i64>
; CHECK-NEXT:
;; 15: void(i1, i3, i5, i8, i16, i32, i64, i128, <8 x i5>, <2 x i64>)
; CHECK-NEXT:
; CHECK-NEXT:
;; 17: b32()
; CHECK-NEXT:
; CHECK-NEXT:
;; 19: b128()
; CHECK-NEXT:
; CHECK-NEXT:
; CHECK-NEXT:
; CHECK-NEXT:
; CHECK-NEXT:
; CHECK-NEXT:
;; Sanity check that the globals are coherently ordered.
; CHECK: record string = 'a'
; CHECK-NEXT: record string = 'bytes'
; CHECK-NEXT: record string = 'constant128'
; CHECK-NEXT: record string = 'constant32'
; CHECK-NEXT:
@a = common global [32 x b8] zeroinitializer, align 1
define void @bytes(b1 %a, b3 %b, b5 %c, b8 %d, b16 %e, b32 %f, b64 %g, b128 %h, <8 x b5> %i, <2 x b64> %j) {
; CHECK:
;; The value here is signed variable-length encoded, so the value is doubled
; CHECK-NEXT:
ret b32 123
}
define b128 @constant128() {
; CHECK:
;; The value here is signed variable-length encoded, so the value is doubled
; CHECK-NEXT:
ret b128 12341234
}